JDK-4125644 : RFE: Improve locale handling in String.toLowerCase/toUpperCase
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1998-04-03
  • Updated: 2005-09-13
  • Resolved: 2005-09-13
Related Reports
Relates :  
Description
In src/share/classes/java/lang/String.java, String.toLowerCase(Locale)
(and String.toUpperCase(Locale)) start off with

	if (locale.getLanguage().equals("tr")) ...

with some special code for the Turkish locale.  Since we are already 
doing a dispatch to the locale, why not add toLowerCase(char[]) to 
the Locale API and let the locale do the conversion itself.  There 
could be a default implementation that does the fast loop, but then
the Turkish locale could have an overriding definition that does the 
dotted i transformation.  Object oriented code!  What a concept.

The default implementation could use Character.toLowerCase just like 
now.  Or the 8859-1 locale (I'm probably mixing types here) could 
special case 'A'..'Z' and rest of the ASCII subset not do the shifting 
and masking and 3 (count 'em, 3) array subscript operations in the 
usual case where you just have ASCII characters.  Or you could push 
the ASCII special case code down into Character.toLowerCase and win 
for the other people that use that method.

peter.kessler@Eng 1998-04-03

Comments
EVALUATION The performance issue should be addressed in 6313320.
14-09-2005

EVALUATION In any case we can't remove the current locale sensitive function from the methods. I'm closing this method as Will Not Fix.
13-09-2005

PUBLIC COMMENTS Locale should know how to translate its characters
18-06-2004

EVALUATION In the Java locale architecture, a Locale object only identifies a locale, it doesn't implement locale sensitive operations. This is different from older architectures, where a locale is the entire blob of locale-sensitive functionality. The Java approach allows anybody to provide additional locale sensitive functionality. String.toLowerCase and toUpperCase have to handle any combination of Unicode characters. Unlike on older platforms, the set of possible characters in a String is not limited by a locale. norbert.lindenberg@Eng 1999-07-26 The suggestions for performance improvement should be implemented. norbert.lindenberg@Eng 2000-02-25 Moved the second bug description (uppercasing fails for single sharp s) to 4219630. norbert.lindenberg@Eng 2000-02-29
25-02-2000