All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
VBScript实现对Windows注册表的修改_JavaScript技术_编程技术
PHP对GB编码动态转UTF-8几种方法评测_php资料_编程技术
Sqlserver应用内置工具建立审查系统_[SQL,Server教程]
如何用一条sql取得第10到第20条的记录?_[SQL Server教程]
安装SQL,Server,2005的AdventureWorks_[SQL,Server教程]
如何在十天内学会php之第六天_php资料_编程技术
利用DataGrid显示某目录下的所有文件_[Asp.Net教程]
Asp.Net,XML操作基类_[Asp.Net教程]
升级PHP5的理由:PHP4和PHP5性能对比_php资料_编程技术
asp.net2.0文章标题后加new或new图片_[Asp.Net教程]
Reading number is top 10 pictures
Discharge accidentally Actresses by the breast4
这才是真正的人体艺术2
Sora aoi in China4
Original author said, this is the Hengyang people
Plump, too plump!2
Sell the barbecue as says father du breul3
No trading, no killing
The real super beauty8
The world's top ten most beautiful railway station2
Sora aoi mirror memorial classics4
Download software ranking
jBuilder2006
The Bermuda triangle2
Boxer's Top ten classic battle3
WebService在.NET中的实战应用教学视频 → 第5集
I'm come from Beijing2
天龙八部最新服务端
I for your crazy
仙剑奇侠传98版歌曲
linux初级教程
Twenty piece of palm leaf
归海一刀 published in(发表于) 2014/3/16 2:52:15 Edit(编辑)
Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]_0

Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]_0

Ajax开发过程中提交获取数据的乱码问题_[AJAX教程]























这两天在继续我的Ajax之旅。一直在抓紧步伐。

  前天试验使用Ajax提交form表单到服务器,获取form信息内容出现了乱码,一时无法解决。网上有结论说是application/x-www-form-urlencoded编码的原因,我估计也是。正在寻找解决之道。

  大家一起讨论讨论。

  补充:通过在后台用UTF8转码的方式可以解决中文乱码问题。这种方法针对form表单提交,编码在服务器完成。代码如下:


  form.jsp:









<%@ page contentType="text/html; charset=gb2312"%>



表单提交测试














用户名:















密码:































  form_handle.jsp:









<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%
String username = new String(request.getParameter("username").getBytes("ISO-8859-1"),"UTF8");
String password = request.getParameter("password");
System.out.println("用户名:"+username);
System.out.println("密码:"+password);
out.println(username+"|"+password);
%>






  另外,有些网友反应生成包含中文内容的XML文档返回到客户端也会出现乱码问题。建议将XML文档的编码方式改成UTF8试试看。









































添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.