Re: Conversion of Java Strings between different encodings.
Posted By:
Dave_Stone
Posted On:
Wednesday, May 2, 2001 01:44 PM
You should have used
String strUTF = new String(str.getBytes("UTF8"), "UTF8"); and
String strSJIS = new String(str.getBytes("SJIS"), "SJIS");
Without encoding specification getBytes() converts internal two-byte character to byte array using system default (most likely USASCII or ISO8859_1).
Also, you should use newstr = new String(strUTF.getBytes("UTF8"), "UTF8").