`
Jellen129
  • 浏览: 61949 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

JSON.stringify() 之后出现isHexDigit错误解决

    博客分类:
  • web
阅读更多

JSON.stringify(values)之后,出现以下错误:

 

警告: Parameters: Invalid chunk ignored.
2013-1-30 10:54:14 org.apache.tomcat.util.http.Parameters processParameters
警告: Parameters: Character decoding failed. Parameter skipped.
java.io.CharConversionException: isHexDigit
    at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
    at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
    at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:412)
    at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:394)
    at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:346)
    at org.apache.catalina.connector.Request.parseParameters(Request.java:2503)
    at org.apache.catalina.connector.Request.getParameter(Request.java:1040)
    at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:355)
    at cn.kyinfo.webframe.filter.SecurityFilter.doFilter(SecurityFilter.java:131)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at cn.kyinfo.webframe.filter.PermissionResetFilter.doFilter(PermissionResetFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at cn.kyinfo.webframe.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:90)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at cn.kyinfo.webframe.filter.EncodingFilter.doFilter(EncodingFilter.java:34)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:619)

 

 

解决方法:

仔细找了下资料,发现原来是编码问题,将数据再重新编码,搞定。如下:

encodeURIComponent(JSON.stringify(values));

 

encodeURIComponent 参考

定义和用法

encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。

 

语法

encodeURIComponent(URIstring)

 

返回值

URIstring 的副本,其中的某些字符将被十六进制的转义序列进行替换。

 

说明

该方法不会对 ASCII 字母和数字进行编码,也不会对这些 ASCII 标点符号进行编码: - _ . ! ~ * ' ( ) 。

其他字符(比如 :;/?:@&=+$,# 这些用于分隔 URI 组件的标点符号),都是由一个或多个十六进制的转义序列替换的。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics