-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
generic
-
generic
Name: ooR10006 Date: 01/05/2001
Character.getNumericValue(ch) method returns incorrect values for the following
chars:
0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a 0x4b 0x4c 0x4d 0x4e 0x4f 0x50
0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x61 0x62 0x63 0x64 0x65 0x66
0x67 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 0x74 0x75 0x76
0x77 0x78 0x79 0x7a 0xff21 0xff22 0xff23 0xff24 0xff25 0xff26 0xff27 0xff28
0xff29 0xff2a 0xff2b 0xff2c 0xff2d 0xff2e 0xff2f 0xff30 0xff31 0xff32 0xff33
0xff34 0xff35 0xff36 0xff37 0xff38 0xff39 0xff3a 0xff41 0xff42 0xff43 0xff44
0xff45 0xff46 0xff47 0xff48 0xff49 0xff4a 0xff4b 0xff4c 0xff4d 0xff4e 0xff4f
0xff50 0xff51 0xff52 0xff53 0xff54 0xff55 0xff56 0xff57 0xff58 0xff59 0xff5a
jdk1.4.0beta-b45 specification reads:
" public static int getNumericValue(char ch)
Returns the int value that the specified Unicode character represents.
For example, the character '\u216C' (the roman numeral fifty) will return
an int with a value of 50.
If the character does not have a numeric value, then -1 is returned.
If the character has a numeric value that cannot be represented as a nonnegative
integer (for example, a fractional value), then -2 is returned."
According to this, Character.getNumericValue(ch) should return -1 for the specified
above chars, since Unicode3.0 defines no numeric values for these chars.
However, jdk1.4.0beta-b45 API implementation returns the following corresponding
decimal values:
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 10
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 10 11
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 10 11 12
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
The following simple test shows this:
public class test {
public static void main(String[] args){
System.out.println(Character.getNumericValue((char)0x41) + " " +
Character.getNumericValue((char)0x42) + " " + Character.getNumericValue((char)0x43) + " " +
Character.getNumericValue((char)0x44) + " " + Character.getNumericValue((char)0x45) + " " +
Character.getNumericValue((char)0x46) + " " + Character.getNumericValue((char)0x47) + " " +
Character.getNumericValue((char)0x48) + " " + Character.getNumericValue((char)0x49) + " " +
Character.getNumericValue((char)0x4a) + " " + Character.getNumericValue((char)0x4b) + " " +
Character.getNumericValue((char)0x4c) + " " + Character.getNumericValue((char)0x4d) + " " +
Character.getNumericValue((char)0x4e) + " " + Character.getNumericValue((char)0x4f) + " " +
Character.getNumericValue((char)0x50) + " " + Character.getNumericValue((char)0x51) + " " +
Character.getNumericValue((char)0x52) + " " + Character.getNumericValue((char)0x53) + " " +
Character.getNumericValue((char)0x54) + " " + Character.getNumericValue((char)0x55) + " " +
Character.getNumericValue((char)0x56) + " " + Character.getNumericValue((char)0x57) + " " +
Character.getNumericValue((char)0x58) + " " + Character.getNumericValue((char)0x59) + " " +
Character.getNumericValue((char)0x5a) + " " + Character.getNumericValue((char)0x61) + " " +
Character.getNumericValue((char)0x62) + " " + Character.getNumericValue((char)0x63) + " " +
Character.getNumericValue((char)0x64) + " " + Character.getNumericValue((char)0x65) + " " +
Character.getNumericValue((char)0x66) + " " + Character.getNumericValue((char)0x67) + " " +
Character.getNumericValue((char)0x68) + " " + Character.getNumericValue((char)0x69) + " " +
Character.getNumericValue((char)0x6a) + " " + Character.getNumericValue((char)0x6b) + " " +
Character.getNumericValue((char)0x6c) + " " + Character.getNumericValue((char)0x6d) + " " +
Character.getNumericValue((char)0x6e) + " " + Character.getNumericValue((char)0x6f) + " " +
Character.getNumericValue((char)0x70) + " " + Character.getNumericValue((char)0x71) + " " +
Character.getNumericValue((char)0x72) + " " + Character.getNumericValue((char)0x73) + " " +
Character.getNumericValue((char)0x74) + " " + Character.getNumericValue((char)0x75) + " " +
Character.getNumericValue((char)0x76) + " " + Character.getNumericValue((char)0x77) + " " +
Character.getNumericValue((char)0x78) + " " + Character.getNumericValue((char)0x79) + " " +
Character.getNumericValue((char)0x7a) + " " + Character.getNumericValue((char)0xff21) + " " +
Character.getNumericValue((char)0xff22) + " " + Character.getNumericValue((char)0xff23) + " " +
Character.getNumericValue((char)0xff24) + " " + Character.getNumericValue((char)0xff25) + " " +
Character.getNumericValue((char)0xff26) + " " + Character.getNumericValue((char)0xff27) + " " +
Character.getNumericValue((char)0xff28) + " " + Character.getNumericValue((char)0xff29) + " " +
Character.getNumericValue((char)0xff2a) + " " + Character.getNumericValue((char)0xff2b) + " " +
Character.getNumericValue((char)0xff2c) + " " + Character.getNumericValue((char)0xff2d) + " " +
Character.getNumericValue((char)0xff2e) + " " + Character.getNumericValue((char)0xff2f) + " " +
Character.getNumericValue((char)0xff30) + " " + Character.getNumericValue((char)0xff31) + " " +
Character.getNumericValue((char)0xff32) + " " + Character.getNumericValue((char)0xff33) + " " +
Character.getNumericValue((char)0xff34) + " " + Character.getNumericValue((char)0xff35) + " " +
Character.getNumericValue((char)0xff36) + " " + Character.getNumericValue((char)0xff37) + " " +
Character.getNumericValue((char)0xff38) + " " + Character.getNumericValue((char)0xff39) + " " +
Character.getNumericValue((char)0xff3a) + " " + Character.getNumericValue((char)0xff41) + " " +
Character.getNumericValue((char)0xff42) + " " + Character.getNumericValue((char)0xff43) + " " +
Character.getNumericValue((char)0xff44) + " " + Character.getNumericValue((char)0xff45) + " " +
Character.getNumericValue((char)0xff46) + " " + Character.getNumericValue((char)0xff47) + " " +
Character.getNumericValue((char)0xff48) + " " + Character.getNumericValue((char)0xff49) + " " +
Character.getNumericValue((char)0xff4a) + " " + Character.getNumericValue((char)0xff4b) + " " +
Character.getNumericValue((char)0xff4c) + " " + Character.getNumericValue((char)0xff4d) + " " +
Character.getNumericValue((char)0xff4e) + " " + Character.getNumericValue((char)0xff4f) + " " +
Character.getNumericValue((char)0xff50) + " " + Character.getNumericValue((char)0xff51) + " " +
Character.getNumericValue((char)0xff52) + " " + Character.getNumericValue((char)0xff53) + " " +
Character.getNumericValue((char)0xff54) + " " + Character.getNumericValue((char)0xff55) + " " +
Character.getNumericValue((char)0xff56) + " " + Character.getNumericValue((char)0xff57) + " " +
Character.getNumericValue((char)0xff58) + " " + Character.getNumericValue((char)0xff59) + " " +
Character.getNumericValue((char)0xff5a));
}
}
-------------------------------------------------------------------------------------------------------
Due to this new JCK Merlin test api/java_lang/Character/index.html#charFullRange[Character2084]
fails.
Similar problem exists in jdk1.3.0fcsC API implementation.
======================================================================
- duplicates
-
JDK-4404977 Incomplete or inaccurate Character spec
-
- Closed
-