`
wxb880114
  • 浏览: 673058 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

警告: Parameters: Character decoding failed. Parameter 'province' with value

阅读更多
  2345积分换礼,设置首页,领工资 )http://www.2345.com/?k1755560   信不信由你,反正我信了---新闻发言人说

警告: Parameters: Character decoding failed. Parameter 'province' with value '%u798F%u5EFA' has been ignored. Note that the name and value quoted here may corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
2012-5-2 14:09:05 org.apache.tomcat.util.http.Parameters processParameters
警告: Parameters: Character decoding failed. Parameter 'city' with value '%u798F%u5DDE' has been ignored. Note that the name and value quoted here may corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
2012-5-2 14:09:05 org.apache.tomcat.util.http.Parameters processParameters
警告: Parameters: Character decoding failed. Parameter 'country' with value '%u957F%u4E50%u5E02' has been ignored. Note that the name and value quoted here may corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.

在Ajax传递参数时,出现数据出现编码问题,在百度搜狗了一下,原来是在
var province=escape(documentById("provcince").value);
将 escape 去掉就ok

  escape,encodeURI,encodeURIComponent是js对文字编码的三种方式,其中 
  传递参数时需要使用encodeURIComponent,这样组合的url才不会被#等特殊字符截断。                          

例如:<script language="javascript">document.write('<a href="http://passport.baidu.com/?logout&aid=7& u='+encodeURIComponent("http://cang.baidu.com/bruce42")+'">退出</a& gt;');</script>

2、   进行url跳转时可以整体使用encodeURI

例如:Location.href=encodeURI("http://cang.baidu.com/do/s?word=百度&ct=21");

3、   js使用数据时可以使用escape

[Huoho.Com编辑]

例如:搜藏中history纪录。

4、   escape对0-255以外的unicode值进行编码时输出%u****格式,其它情况下escape,encodeURI,encodeURIComponent编码结果相同。
   最多使用的应为encodeURIComponent,它是将中文、韩文等特殊字符转换成utf-8格式的url编码,所以如果给后台传递参数需要使用encodeURIComponent时需要后台解码对utf-8支持(form中的编码方式和当前页面编码方式相同)

escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z

encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z

encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z

    escape(str) 方法,它用于转义不能用明文正确发送的任何字符。比如,电话号码中的空格将被转换成字符 %20,从而能够在 URL 中传递这些字符


如果需要发送安全信息或 XML,可能要考虑使用 send() 发送内容(本系列的后续文章中将讨论安全数据和 XML 消息)。如果不需要通过 send() 传递数据,则只要传递 null 作为该方法的参数即可。

js中的escape可以加密数据

  2345积分换礼,设置首页,领工资 )http://www.2345.com/?k1755560   信不信由你,反正我信了---新闻发言人说

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics