Skip to content

Commit

Permalink
Convert to lower, not upper, for casecmp
Browse files Browse the repository at this point in the history
This matches the CRuby code at this point, but it's not clear to
me how or why it was set up to use the upper case table many years
ago.

Fixes jruby#7946
  • Loading branch information
headius committed Oct 9, 2023
1 parent 852abd4 commit ab72a2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/util/StringSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -2505,8 +2505,8 @@ public static int multiByteCasecmp(Encoding enc, ByteList value, ByteList otherV

final int cl, ocl;
if (Encoding.isAscii(c) && Encoding.isAscii(oc)) {
int dc = AsciiTables.ToUpperCaseTable[c];
int odc = AsciiTables.ToUpperCaseTable[oc];
int dc = AsciiTables.ToLowerCaseTable[c];
int odc = AsciiTables.ToLowerCaseTable[oc];
if (dc != odc) return dc < odc ? -1 : 1;

if (enc.isAsciiCompatible()) {
Expand Down

0 comments on commit ab72a2d

Please sign in to comment.