URLDecoder: Illegal hex characters in escape (%) pattern - For input string
原因:后台发布文章的时候,内容里面有
%,导致后台URLDecoder.decode()转码的时候报错。
看了java.net.URLDecoder的decode()的源码,原来是转码错误。
贴出部分代码,意思是取%后面的两位,从16进制转成10进制,要是转码错误就会报出这个异常。
while ( ((i+2) < numChars) && (c=='%')) {
int v = Integer.parseInt(s.substring(i+1,i+3),16);
if (v < 0)
throw new IllegalArgumentException("URLDecoder: Illegal hex characters in escape (%) pattern - negative value");
bytes[pos++] = (byte) v;
i+= 3;
if (i < numChars)
c = s.charAt(i);
}
URLDecoder: Illegal hex characters in escape (%) pattern - For input string的更多相关文章
- java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: " 0"
value = URLDecoder.decode(request.getParameter(paraName), "UTF-8"); 前端用了 encodeURI 来编码参数,后 ...
- java上传附件含有%处理或url含有%(URLDecoder: Illegal hex characters in escape (%) pattern - For input string)
在附件名称中含有%的时候,上传附件进行url编码解析的时候会出错,抛出异常: Exception in thread "main" java.lang.IllegalArgumen ...
- java转换编码报错java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern
Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Illegal hex cha ...
- URLDecoder异常Illegal hex characters in escape (%)
URLDecoder对参数进行解码时候,代码如: URLDecoder.decode(param,"utf-8"); 有时候会出现类似如下的错误: URLDecoder异常Ille ...
- 【Java】Java URLDecoder异常Illegal hex characters in escape (%)
如果收到的HTTP请求参数(URL中的GET请求)中有一个字符串,是中文,比如“10%是黄段子”,服务器段使用URLDecoder.decode就会出现此异常.URL只能使用英文字母.阿拉伯数字和某些 ...
- 【URLDecoder】java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in es
Java调用 URLDecoder.decode(str, "UTF-8"); 抛出以上的异常,其主要原因是% 在URL中是特殊字符,需要特殊转义一下, 上面的字符串中'%'是一个 ...
- URLDecoder: Incomplete trailing escape (%) pattern
在使用URLDecoder对字符串进行解码的时候 报以下异常信息: Exception in thread "main" java.lang.IllegalArgumentExce ...
- URLDecoder: Incomplete trailing escape (%) pattern问题处理
http://blog.csdn.net/yangbobo1992/article/details/10076335 _________________________________________ ...
- PHP出现iconv(): Detected an illegal character in input string
PHP传给JS字符串用ecsape转换加到url里,又用PHP接收,再用网上找的unscape函数转换一下,这样得到的字符串是UTF-8的,但我需要的是GB2312,于是用iconv转换 开始是这样用 ...
随机推荐
- EasyUI中Tabs添加远程数据的方法。
tabs加载远程数据: $(function () { $("#btnquery").click(function () { if (!$("#tcontent" ...
- 用‘+=’拼接字符串,打印时总会出现一个undefined
var str; for(var i = 0; i < 5; i++){ str += String(i); } console.log(str); 他喵的,打印的结果竟然是"unde ...
- python 字符串的方法
capitalize() 把字符串的第一个字符改为大写 casefold() 把整个字符串的所有字符改为小写 center(width) 将字符串居中,并使用空格填充至长度 width 的新字符串 c ...
- 新概念英语(1-133)Sensational news!
Lesson 133 Sensational news! 爆炸性新闻! Listen to the tape then answer this question. What reason did Ka ...
- api-gateway实践(02)新服务网关 - 运行环境
一.服务网关的运行环境 1.服务配置中心 1.1.服务配置中心前台 前台 http://10.110.17.20/#/login:无源码,德奎部署在10.110.17.20的DockerStatck环 ...
- 新概念英语(1-63)Thank you, doctor.
新概念英语(1-63)Thank you, doctor. Who else is in bed today? why? A:How's Jimmy today? B:Better. Thank yo ...
- EasyUI 数据网格行过滤
前段时间发现一个GridView很有用的功能,可以筛选数据,实现起来很简单 一.添加一个引用,这个可以自己去网上下载 <script type="text/javascript&quo ...
- Python基础数据类型之集合以及其他和深浅copy
一.基础数据类型汇总补充 list 在循环一个列表时,最好不要删除列表中的元素,这样会使索引发生改变,从而报错(可以从后向前循环删除,这样不会改变未删元素的索引). 错误示范: lis = [,,, ...
- API之实用工具Postman 使用方法
测试接口与文档信息文件 Postman 安装与入门教程 下载与安装 官方网站:www.getpostman.com 下载完成后,直接安装 输入2次邮箱,密码,即可注册并登陆! 开发者使用: 创建文件夹 ...
- TensorFlow-Slim使用方法说明
翻译自:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim TensorFlow-Slim TF- ...