[关闭]
@Fancy-Bai 2015-08-14T03:36:53.000000Z 字数 289 阅读 1771

中文乱码处理

JavaScript,中文乱码


页面之间传递

js代码中使用:

  1. <script type="text/javascript">
  2. var encode = encodeURI("中国");// 编码
  3. document.write(encode);
  4. var decode = decodeURI(encode);// 解码
  5. document.write(decode);
  6. </script>

前后台传递

java代码中使用:

  1. //var encode = encodeURI("中国");// 编码
  2. String values = java.net.URLDecoder.decode(param, "UTF-8");

亲自试一试

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注