【问题标题】:io.netty.handler.codec.http.multipart.HttpPostRequestDecoder$ErrorDataDecoderException: Bad string invalid escape sequenceio.netty.handler.codec.http.multipart.HttpPostRequestDecoder$ErrorDataDecoderException:错误的字符串无效的转义序列
【发布时间】:2022-01-22 16:14:47
【问题描述】:

当 http 内容包含字符 % 时,io.netty.handler.codec.http.QueryStringDecoder.decodeComponent() 将抛出一个带有消息的IllegalArgumentExceptioninvalid escape sequence `%" ......

这是否意味着 http 内容不能包含 char %? 请求参数为 json str:

{"discountRate":"10%"}

代码细节无法显示;

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: java netty


【解决方案1】:

百分比符号在 URL 中具有特殊含义。文字百分号需要编码为 %25 https://www.urlencoder.io/learn/

【讨论】:

    猜你喜欢
    • 2022-01-26
    • 1970-01-01
    • 2018-06-18
    • 2019-04-12
    • 1970-01-01
    • 2013-09-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多