From ab72a2d2d8f30aaf2ff57af7e2426aafa8f0d27f Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Mon, 9 Oct 2023 09:25:53 -0500 Subject: [PATCH] Convert to lower, not upper, for casecmp 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 #7946 --- core/src/main/java/org/jruby/util/StringSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/jruby/util/StringSupport.java b/core/src/main/java/org/jruby/util/StringSupport.java index ca6e79921e8..8b1e9f81838 100644 --- a/core/src/main/java/org/jruby/util/StringSupport.java +++ b/core/src/main/java/org/jruby/util/StringSupport.java @@ -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()) {