JSP POST传参(乱码) 为何是ISO8859_1
时间:2011-12-28
来源:互联网
A 页面:
HTML code
B 页面:
HTML code
HTML code
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <% response.setCharacterEncoding("UTF-8"); %> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <form action="B.jsp" method="post"> <input type="submit" name="submit" value="中文" /> </form>
B 页面:
HTML code
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <% request.setCharacterEncoding("UTF-8"); %> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <!-- 请问 #P1 为何乱码 --> <p id="p1"><%=request.getParameter("submit")%></p> <!-- 请问 #P2 为何要重建字符串?以前听说POST传参只需设置request编码,为什么是ISO8859_1?--> <p id="p2"><%=new String(request.getParameter("submit").getBytes("ISO8859_1"), "UTF-8")%></p>
作者: admonis 发布时间: 2011-12-28
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8"); %>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
你首先要搞清楚这几个编码的作用
http://apps.hi.baidu.com/share/detail/33081081
<% request.setCharacterEncoding("UTF-8"); %>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
你首先要搞清楚这几个编码的作用
http://apps.hi.baidu.com/share/detail/33081081
作者: zhouyusunquan 发布时间: 2011-12-28
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28