java调用ajax出现乱码解决办法

需要在接收的时候对HttpConnection加入三个编码设置:

   connection.setRequestProperty("Content-type", "text/html");
   connection.setRequestProperty("Accept-Charset", "utf-8");
   connection.setRequestProperty("contentType", "utf-8");

posted @ 2014-12-02 10:57  社区一霸  阅读(236)  评论(0)    收藏  举报