JDK-8248655 : Support supplementary characters in String case insensitive operations
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-07-01
  • Updated: 2022-08-04
  • Resolved: 2020-07-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b08Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8249160 :  
Description
The issue JDK-8248434 revealed that the case-insensitive comparisons for supplementary characters in the following methods  have problems:

java.lang.String.regionMatches(ignoreCase == true, ...)
java.lang.String.equalsIgnoreCase()
java.lang.String.compareToIgnoreCase()

These methods are supposed to match/compare strings in a case-insensitive manner. However, their specs and implementations are char based, which cannot handle supplementary characters correctly. For example,

"\ud83a\udd2e".regionMatches(true, 0, "\ud83a\udd0c", 0, 2)
Returns false (conforming to the existing spec), although "\ud83a\udd2e" is the 'ADLAM SMALL LETTER O' character which has the code point U+1E92E, and "\ud83a\udd0c" is the 'ADLAM CAPITAL LETTER O' character which has the code point U+1E90C. Thus it should return true if it is true to the meaning of "ignore case." This behavior contradicts to the fact that:

"\ud83a\udd2e".toUpperCase(Locale.ROOT).equals("\ud83a\udd0c")
Character.toUpperCase(0x1e92e) == 0x1e90c
each statement returns true.

Both the spec and its implementation need to be modified.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/2d8c578f1230 User: naoto Date: 2020-07-23 15:57:30 +0000
23-07-2020