//编码格式
arg0.pipeline().addLast(new StringEncoder(Charset.forName("GBK")));
//解码格式
arg0.pipeline().addLast(new StringDecoder(Charset.forName("UTF-8")));
ch.pipeline().addLast(new StringEncoder(Charset.forName("UTF-8")));
ch.pipeline().addLast(new StringDecoder(Charset.forName("GBK")));
这有一个编码转换的方法
String strGBK = URLEncoder.encode(str, "GBK");
System.out.println(strGBK);
String strUTF8 = URLDecoder.decode(str, "UTF-8");
System.out.println(strUTF8);