Turn from: http://blog.csdn.net/aaronuu/article/details/7007386
1,byte[] Str.getbytes (String charsetname)
Decodes str to a character array by the specified character set CharsetName.
Returns the decoded character array with the specified character set CharsetName.
2,string (byte[] bytes, String charsetname)
Constructs a new string. Encodes a character array bytes according to the character set specified by the specified character set CharsetName.
3, String str = "Hello";
String newstr = new String (Str.getbytes ("GB2312"), "iso-8859-1");
This means that STR is taken out of the GB2312 encoding, and the extracted character array is encoded with iso-8859-1 to construct the string type Object Newstr
Equivalent:
String str = "Hello";
byte[] TBYTe = str.getbytes ("GB2312")//str encoded by GB2312
String newstr = new String (TBYTe, "iso-8859-1");//convert TBYTe to iso-8859-1 encoded form