[Java]
Public static void main (String [] argv ){
Try {
System. out. println ("Chinese"); // 1
System. out. println ("Chinese". getBytes (); // 2
System. out. println ("Chinese". getBytes ("GB2312"); // 3
System. out. println ("Chinese". getBytes ("ISO8859_1"); // 4
System. out. println (new String ("Chinese". getBytes (); // 5
System. out. println (new String ("Chinese". getBytes (), "GB2312"); // 6
System. out. println (new String ("Chinese". getBytes (), "ISO8859_1"); // 7
System. out. println (new String ("Chinese". getBytes ("GB2312"); // 8
System. out. println (new String ("Chinese". getBytes ("GB2312"), "GB2312"); // 9
System. out. println (new String ("Chinese". getBytes ("GB2312"), "ISO8859_1"); // 10
System. out. println (new String ("Chinese". getBytes ("ISO8859_1"); // 11
System. out. println (new String ("Chinese". getBytes ("ISO8859_1"), "UTF-8"); // 12
System. out. println (new String ("Chinese text message". getBytes ("ISO8859_1"), "UTF-8"); // 13
// Encoding and decoding
String cont = URLEncoder. encode (new String ("what are you doing? 33335"), "UTF-8 ");
System. out. println ("0:" + cont );
String after = URLDecoder. decode (cont, "UTF-8 ");
System. out. println ("1:" + after );
} Catch (Exception e ){
System. out. println (e. getMessage ());
}
}
Author: kobi521