先来说说几种常见的解决方案:
(1)在response返回数据包之前设置它的encoding值
方法:response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("UTF-8");
(2)使用String类来解决
方法:String chinese = "我只说中国话!";
byte[] str = chinese.getBytes("gb2312");//这儿还有选项GBK, ISO-8859-1