[kaffe] Re: java/text/SimpleDateFormat.java (compileFormat)
Ito Kazumitsu
kaz@maczuka.gcd.org
Thu Nov 27 14:31:02 2003
Hi,
>>>>> ":" == Michael Koch <konqueror@gmx.de> writes:
>> I am afraid "Character.isLowerCase(char) || Character.isUpperCase(char)"
>> also allows too many characters, including Greek or Slavic alphabet
>> or even Japanese Zenkaku alphabet.
:> Grrr! I thought its the same. All I found int the docs indicated this.
:> Can you please commit/provide a patch that fixes this ?
The API document of java.lang.Character says:
The following are examples of lowercase characters:
a b c d e f g h i j k l m n o p q r s t u v w x y z
'\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
'\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
'\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
'\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
Many other Unicode characters are lowercase too.
I do not know of a smart way of describing characters between 'A' and 'Z'
and 'a' and 'z', so my patch is:
--- java/text/SimpleDateFormat.java.orig Mon Nov 24 23:59:09 2003
+++ java/text/SimpleDateFormat.java Fri Nov 28 07:05:10 2003
@@ -117,8 +117,8 @@
field = formatData.getLocalPatternChars().indexOf(thisChar);
if (field == -1) {
current = null;
- if (Character.isLowerCase (thisChar)
- || Character.isUpperCase (thisChar)) {
+ if ((thisChar >= 'A' && thisChar <= 'Z')
+ || (thisChar >= 'a' && thisChar <= 'z')) {
// Not a valid letter
tokens.add(new FieldSizePair(-1,0));
} else if (thisChar == '\'') {
ChangeLog entry:
2003-11-28 Ito Kazumitsu <kaz@maczuka.gcd.org>
* java/text/SimpleDateFormat.java (compileFormat):
isLowerCase and isUpperCase allow too many characters.
Just use >= 'A' && <= 'Z' || >= 'a' && <= 'z'.