Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with Character.getNumericValue

807600Jul 6 2007 — edited Jul 6 2007
String name = "bobboli -_()あ!.。県きkk";
(inside a for loop)
int codePoint = name.codePointAt(i);
System.out.print(name.codePointAt(i) + " " + name.charAt(i));

Returns: A bunch of code point numbers and the characters of what cmd.exe can display (cmd doesn't display unicode, but that is another issue)

char bill = 'あ';
System.out.println(" " + Character.getNumericValue(bill));
System.out.println(" " + Character.getNumericValue('a'));
System.out.println(" " + Character.getNumericValue('.'));

Returns:
-1
10
-1

Where from the first bit of code, I know that あ (japanese 'a') is 12354, but I don't understand why I am getting -1 when trying to get the NumericValue as well as -1 for '.'


Encoding is utf-8 for the file, and I run javac -encoding utf-8 on the java file
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2007
Added on Jul 6 2007
6 comments
376 views