10,612
社区成员




strEncoding = req.getCharacterEncoding();
if(req.getHeader("accept-language").startsWith("en")) {
strEncoding = "ISO8859_1";
}
str = new String(str.getBytes(strEncoding), "GBK");
String s = "中国人 text here";
byte[] b = s.getBytes("UTF-8");
//假设,上面是浏览器的,他要传输,必须变0101, b变成0101了。
//下面是服务器的,他接收了一串0101,他要变String;
String s1 = new String(b,"UTF-8");
String s2 = new String(b,"GBK");