[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java/text/SimpleDateFormat.java (compileFormat)
From: |
Ito Kazumitsu |
Subject: |
Re: java/text/SimpleDateFormat.java (compileFormat) |
Date: |
Fri, 28 Nov 2003 07:25:02 +0900 |
User-agent: |
EMH/1.10.0 SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.2 (i386-unknown-freebsd4.7) MULE/5.0 (SAKAKI) |
Hi,
>>>>> ":" == Michael Koch <address@hidden> 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 <address@hidden>
* java/text/SimpleDateFormat.java (compileFormat):
isLowerCase and isUpperCase allow too many characters.
Just use >= 'A' && <= 'Z' || >= 'a' && <= 'z'.