jsp传中文乱码问题 encodeURIComponent()编码方法
2014-06-13 18:56
435 查看
方法一:
jQuery.ajax({
type:"POST",
url:"${ctx}/offer.do",
data:{
'method':'isNameExist',
'type':'area',
'id':id==""?null:id,
'name':encodeURIComponent(offerAreaName)
},
async:false,
success:function (data) {
bool = data;
}
});
action里特别设置:
String offerAreaName= request.getParameter("offerAreaName");
if(StringUtils.isNotEmpty(offerAreaName)){
productName = new String(offerAreaName.getBytes("iso8859-1"),"UTF-8");
}
方法二:
window.encodeURI(window.encodeURI(strBuf)) 编译后在传
处理方法中(action 或者 service):
try {
strBuf= java.net.URLDecoder.decode(strBuf,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
jQuery.ajax({
type:"POST",
url:"${ctx}/offer.do",
data:{
'method':'isNameExist',
'type':'area',
'id':id==""?null:id,
'name':encodeURIComponent(offerAreaName)
},
async:false,
success:function (data) {
bool = data;
}
});
action里特别设置:
String offerAreaName= request.getParameter("offerAreaName");
if(StringUtils.isNotEmpty(offerAreaName)){
productName = new String(offerAreaName.getBytes("iso8859-1"),"UTF-8");
}
方法二:
window.encodeURI(window.encodeURI(strBuf)) 编译后在传
处理方法中(action 或者 service):
try {
strBuf= java.net.URLDecoder.decode(strBuf,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
相关文章推荐
- JSP、AJax中文乱码问题解决,escape(), encodeURI(), encodeURIComponent(),js对参数连续两次调用 encodeURI(String) 方法
- JSP、AJax中文乱码问题解决,escape(), encodeURI(), encodeURIComponent(),js对参数连续两次调用 encodeURI(String) 方法
- 前台使用js的encodeURIComponent编码后,java解析乱码问题的解决方法
- encodeURIComponent编码 URLDecoder.decode解码乱码的问题
- jspsmartupload上传文件名中文乱码和超链接传递路径参数encodeURIComponent加解码
- 中文乱码 ajax使用encodeURIComponent()或encodeURI()编码 location.herf编码两次
- 使用escape、encodeURI 和 encodeURIComponent 解决url中文乱码问题
- 中文乱码--MySQL5.0中文问题及JDBC数据库连接和JSP汉字编码问题解决方法总
- encodeURIComponent编码 URLDecoder.decode解码乱码的问题
- JSP页面编码问题研究三(中文字符乱码问题的解决方法)
- encodeURIComponent编码 URLDecoder.decode解码乱码的问题
- ajax中文编码问题--encodeURIComponent() 与encodeURI()
- 使用escape、encodeURI 和 encodeURIComponent 解决url中文乱码问题
- 一:Js的Url中传递中文参数乱码问题,重点:encodeURI编码,decodeURI解码:
- 使用escape、encodeURI 和 encodeURIComponent 解决url中文乱码问题
- 前台用js的encodeURIComponent对中文编码,后台正确获取值的方法
- encodeURI与encodeURIComponent方法的区别 如果你使用的get方法提交表单肯定要考虑到输入项目的编码解码问题。 解决这个问题大家一般都使用encodeURI或者en
- %25%37%DD 。。。上述形式不是乱码。 这是urlencoding。 你可以使用js内置的方法 encodeURIComponent进行编码, 而使用decodeURIComponent把上述形式再解码为普通字符
- 彻底解决jsp中文乱码问题(eclips 添加中文编码方式gb2312).
- JSP字符中文乱码问题解决方法汇总