1. java怎麼把把字元轉成utf-8
java不同編碼之間進行轉換,都需要使用unicode作為中轉。
以utf-8轉gbk為例,示例代碼如下:
String t = "這是一個字元串aaa111";
String utf8 = new String(t.getBytes( "UTF-8"));
System.out.println(utf8);
String unicode = new String(utf8.getBytes(),"UTF-8");
System.out.println(unicode);
String gbk = new String(unicode.getBytes("GBK"));
System.out.println(gbk);
2. java jsonObject中unicode 轉 utf-8問題
java 中有轉義字元的概念:
八進制轉義序列: + 1到3位5數字;范圍'