C
Crazy Monkey
Hi:
I need to convert special characters into its numerical values. I
found charCodeAt() function in JavaScript that does the trick. For
example
var testString = "èû";
testString.charCodeAt(0) will return 138
testString.charCodeAt(1) will return 150
I need something in Java that will do the same thing. So far the
closest thing I got is
char char1 = 'è';
int ci = (int) char1; gives me 232
char char1 = 'û';
int ci = (int) char1; gives me 251
As you see, the conversion does not match. The Java part is giving me
a HTML encoded representation. JavaScript charCodeAt() is doing
something else. I need Java to generate the same code as JavaScript.
Any hints.
Thanks.
Crazy Monkey
I need to convert special characters into its numerical values. I
found charCodeAt() function in JavaScript that does the trick. For
example
var testString = "èû";
testString.charCodeAt(0) will return 138
testString.charCodeAt(1) will return 150
I need something in Java that will do the same thing. So far the
closest thing I got is
char char1 = 'è';
int ci = (int) char1; gives me 232
char char1 = 'û';
int ci = (int) char1; gives me 251
As you see, the conversion does not match. The Java part is giving me
a HTML encoded representation. JavaScript charCodeAt() is doing
something else. I need Java to generate the same code as JavaScript.
Any hints.
Thanks.
Crazy Monkey