ajax url中含有中文参数 后台接受产生乱码解决方案
来源:互联网 发布:今十数据财经日历 编辑:程序博客网 时间:2024/06/08 06:23
可以使用encodeURIComponent() 或encodeURIComponent() (这个我没试过,前者是可以的)
对中文参数进行编码转换,便可以解决问题
下面附上这个两个方法的解释:
encodeURI() 方法:把URI字符串采用UTF-8编码格式转化成escape格式的字符串。不会被此方法编码的字符:! @ # $& * ( ) = : / ; ? + '
英文解释:MSDN JScript Reference: The encodeURI method returns an encoded URI. If you pass the result to decodeURI, the original string is returned. The encodeURI method does not encode the following characters: ":", "/", ";", and "?". Use encodeURIComponent to encode these characters. Edge Core Javascript Guide: Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character
encodeURIComponent() 方法:把URI字符串采用UTF-8编码格式转化成escape格式的字符串。与encodeURI()相比,这个方法将对更多的字符进行编码,比如 / 等字符。所以如果字符串里面包含了URI的几个部分的话,不能用这个方法来进行编码,否则 / 字符被编码之后URL将显示错误。不会被此方法编码的字符:! * ( )
英文解释:MSDN JScript Reference: The encodeURIComponent method returns an encoded URI. If you pass the result to decodeURIComponent, the original string is returned. Because the encodeURIComponent method encodes all characters, be careful if the string represents a path such as /folder1/folder2/default.html. The slash characters will be encoded and will not be valid if sent as a request to a web server. Use the encodeURI method if the string contains more than a single URI component. Mozilla Developer Core Javascript Guide: Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.
- ajax url中含有中文参数 后台接受产生乱码解决方案
- ajax get请求乱码,后台获取url中参数乱码解决方案
- URL参数带中文,后台接收乱码解决方案
- URL/ajax带中文参数,后台获取乱码
- AJAX请求URL中带入中文参数,后台接收乱码问题
- 关于ajax中URL传递中文产生乱码的问题
- URL中文参数乱码解决方案
- url中有中文参数时,后台乱码怎么整
- Ajax中文参数乱码解决方案
- 地址栏中输入中文参数,后台得到乱码解决方案
- URL传递中文参数中乱码问题的解决方案
- jsp中url传递中文参数乱码的暂时解决方案
- 后台接受中文或者非中文参数终极解决方案
- JSP传URL中文参数乱码解决方案
- 【工作笔记0010】asp.net后台Request.QueryString获取的url中文参数乱码解决方案
- js、URL传递含有中文参数时的乱码问题解决
- js、URL传递含有中文参数时的乱码问题解决
- ajax 解决url中文参数乱码问题
- alfresco 4.0 源码 下载 编译 调试
- Extjs显示图片
- jpct-ae坐标系
- 看张亚飞《.Net for Flash FMS》的笔记<一>
- photoshop如何删除切片
- ajax url中含有中文参数 后台接受产生乱码解决方案
- struts学习心得
- CCS开发环境搭建小结
- JPA2.0的学习
- Havij 1.152 最新破解版
- oracle触发器和自动增长列
- 变序性算法
- 修改 myeclipse8.5 jsp 模板
- E: Package 'sun-java6-jdk' has no installation candidate