当前位置: 代码迷 >> Web前端 >> 解决中文乱码有关问题
  详细解决方案

解决中文乱码有关问题

热度:16   发布时间:2012-11-05 09:35:12.0
解决中文乱码问题

1.页面端发出的数据做一次encodeURI(),服务器端做new String(xxx.getByte("is0-8859-1"),"utf-8");

?????? encodeURI(username);

?????? new String(name.getByte("is0-8859-1"),"utf-8");

2.页面端发出的数据作两次encodeURI,服务器端做URLDecode。

?????? ?? encodeURI(encodeURI(username));

????????? String name = URLDecode.decode(name,“utf-8”);

  相关解决方案