JAVA 中字符编码问题
package test; import java.io.UnsupportedEncodingException; import java.util.Arrays; public class StringDemo { public static void main(String[] args) throws UnsupportedEncodingException { String s = "中国"; byte[] bytes = s.getBytes("GBK"); System.out.println(Arrays.toString(bytes)); //[-28, -72, -83, -27, -101, -67] String ss =new String(bytes,"GBK"); System.out.println(ss); } }