M
maxwelton
I have a situation where I read a string of settings from
a cookie. One section of this string has UTF-8 encoded
characters.
get the bytes I have to use a call like this specifying
"8859_1":
String cookieData; // populated by cookie token.
..
..
byte[] utf8Contents = cookieData.getBytes("8859_1");
// then to get it where the applet will display it
// I have to put it in UTF-16 by doing this.
String userData = new String(utf8Contents, "UTF-8");
don't know of any limits so far, but what bothers me
and what I don't understand is why does "8859_1" have
to be specified? Nothing I am doing should be specific
to that encoding. I have tried the getBytes() without
specifying the encoding but it didn't seem to work
unless I missed something. Should it have worked?
a cookie. One section of this string has UTF-8 encoded
characters.
see "UTF-8 and Unicode, Oct 17, 2001" I discover toFrom reading an earlier topic in this news group;
get the bytes I have to use a call like this specifying
"8859_1":
String cookieData; // populated by cookie token.
..
..
byte[] utf8Contents = cookieData.getBytes("8859_1");
// then to get it where the applet will display it
// I have to put it in UTF-16 by doing this.
String userData = new String(utf8Contents, "UTF-8");
the unicode values I have tried up to 0441. IFrom the testing I have done so far this works on all
don't know of any limits so far, but what bothers me
and what I don't understand is why does "8859_1" have
to be specified? Nothing I am doing should be specific
to that encoding. I have tried the getBytes() without
specifying the encoding but it didn't seem to work
unless I missed something. Should it have worked?