讨论下面的一个问题,
用eclipse ee建立一个dynamic web program ,写一个页面index.jsp包含一个表单输入框name="data",然后添加一个servlet,把表单提交到servlet,然后获取data的内容,
请问我怎么能够获取以utf8编码的data的内容啊....前提:
首选项的工作空间编码 utf8
jsp页面 contentType="text/html; charset=utf-8" pageEncoding="utf-8"
jsp的html内容 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
tomcat的conf/server.xml URIencoding="utf8"请大牛们帮忙,我无论怎么操作都不能得到想要的结果
iso-8859-1 to utf-8 错 得到的是GBK的编码
iso-8859-1 to gbk 错 得到的还是GBK的编码...求人关注,不明白我的问题可以提问,希望能够解决问题,先谢谢大家了;
用eclipse ee建立一个dynamic web program ,写一个页面index.jsp包含一个表单输入框name="data",然后添加一个servlet,把表单提交到servlet,然后获取data的内容,
请问我怎么能够获取以utf8编码的data的内容啊....前提:
首选项的工作空间编码 utf8
jsp页面 contentType="text/html; charset=utf-8" pageEncoding="utf-8"
jsp的html内容 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
tomcat的conf/server.xml URIencoding="utf8"请大牛们帮忙,我无论怎么操作都不能得到想要的结果
iso-8859-1 to utf-8 错 得到的是GBK的编码
iso-8859-1 to gbk 错 得到的还是GBK的编码...求人关注,不明白我的问题可以提问,希望能够解决问题,先谢谢大家了;
解决方案 »
- cas spring security3整合爆错
- jquery弹出窗效果
- struts2标签中调用JS代码验证无效,不知道哪里错了,各位帮我看看啊
- 用户的服务器设这了密码,我如何写url
- myeclipse如何生成ear文件,就是想把一个.jar文件和一个.war文件打到一块部署
- 高手请进,关于Hibernate的问题
- 在linux下jsp文件放在jboss的哪个目录下?
- spring有什么好书吗
- 初学STRUTS问题,STRUTS如何连接access的数据源
- 一个很初级的问题:“Bean”到底什么意思?
- 已导入commons-logging.jar显示NoClassDefFoundError: org/apache/commons/logging/LogFact
- 谁能帮我看看是哪里出错了
<%
request.setCharacterEncoding("utf—8");
%>
注意是写在《html》标签外面
然而事情不总那么美好,
在chrom下是好的,在IE下却得到的是iso-8859-1的byte数组。
能知道是什么问题吗?
httpRequest = createHttpRequest();
httpRequest.onreadystatechange = aa;
httpRequest.open("GET",url,true);
httpRequest.send(null);2.为了解决返回值XMLHttpRequest.resopnseText中文乱码的问题,需要设置下面这句话:response.setHeader("Charset","UTF-8");
http://smallbottlecover.blog.hexun.com/10910911_d.html
String ss = new String(Request().getParameter("名").getBytes("ISO-8859-1"),"utf-8"));
或者
String ss = new String(Request().getParameter("名").getBytes("ISO-8859-1"),"gb2312"));然后
ss.getBytes("utf-8");