在使用URLDecoder对字符串进行解码的时候 报以下异常信息:

Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern

原因是字符串中包含有%字符

解决方法如下 example:

String str = "hello该字符串中包含%";
System.out.println(URLDecoder.decode(str.replaceAll("%", "%25"), "UTF-8"));

常见URL编码表:

URLDecoder: Incomplete trailing escape (%) pattern的更多相关文章

  1. URLDecoder: Incomplete trailing escape (%) pattern问题处理

    http://blog.csdn.net/yangbobo1992/article/details/10076335 _________________________________________ ...

  2. URLDecoder: Illegal hex characters in escape (%) pattern - For input string

    原因:后台发布文章的时候,内容里面有%,导致后台URLDecoder.decode()转码的时候报错. 看了java.net.URLDecoder的decode()的源码,原来是转码错误. 贴出部分代 ...

  3. java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: " 0"

    value = URLDecoder.decode(request.getParameter(paraName), "UTF-8"); 前端用了 encodeURI 来编码参数,后 ...

  4. java转换编码报错java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern

    Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Illegal hex cha ...

  5. java上传附件含有%处理或url含有%(URLDecoder: Illegal hex characters in escape (%) pattern - For input string)

    在附件名称中含有%的时候,上传附件进行url编码解析的时候会出错,抛出异常: Exception in thread "main" java.lang.IllegalArgumen ...

  6. URLDecoder异常Illegal hex characters in escape (%)

    URLDecoder对参数进行解码时候,代码如: URLDecoder.decode(param,"utf-8"); 有时候会出现类似如下的错误: URLDecoder异常Ille ...

  7. URLDecoder异常解决方法

    URLDecoder对参数进行解码时候,代码如: URLDecoder.decode(param,"utf-8"); 有时候会出现类似如下的错误: URLDecoder异常Ille ...

  8. URL编码 URLEncoder 示例

    2016-12-27 对字符编码时的规则 通常如果一样东西需要编码,说明这样东西并不适合传输.原因多种多样,如Size过大,包含隐私数据. 对于Url来说,之所以要进行编码,一个是因为Url中有些字符 ...

  9. JAVA判断URL地址是否非法

    /** * 判断请求url是否非法 * @param url * @return */ public static boolean isValidRequestUri(String url) { if ...

随机推荐

  1. 收集的css布局

    1 <title>左定宽,右自动</title> 2 <style> 3 body{margin:0px;padding:0px;} 4 .box .left,.b ...

  2. 又一次拾起C语言的威严

    自从用了C++,他的方便快捷一直用着屡试不爽,可是越用越认为程序不够清晰, 项目使用DSP,不得不把C++重写成C 速度没得说,很快 记录下看到的文章 少走弯路,学好C语言的推荐途径

  3. Excel 删除所有错误公式

    当前工作表的话可以F5-定位-公式-错误值 来选中所有含错误值的单元格,然后按delete删除. 多表的话没办法了,因为不能跨工作表多重选中,只能一页页的删,或者用vba编个宏来解决

  4. 记录近期小改Apriori至MapReduce上的心得

    ·背景 前一阵,一直在研究一些ML的东东,后来工作关系暂停了一阵.现在继续把剩下一些热门的算法再吃吃透,"无聊+逗比"地把他们搞到MapReduce上.这次选择的入手对象为Apri ...

  5. MVC创建XML,并实现增删改

    原文:MVC创建XML,并实现增删改 如果创建如下的XML: <?xml version="1.0" encoding="utf-8" standalon ...

  6. [C#]设置或取消开机启动(注册表形式)

    原文:[C#]设置或取消开机启动(注册表形式) 使用代码: 代码效果:

  7. STL在迭代的过程,删除指定的元素

    直接在Code.在 Picture #include <iostream> #include <list> using namespace std; // STL在迭代的过程中 ...

  8. LeetCode之Max Points on a Line Total

    1.问题描述 Given n points on a 2D plane, find the maximum number of points that lie on the same straight ...

  9. leetcode第37题--Count and Say

    题目:(据说是facebook的面试题哦) The count-and-say sequence is the sequence of integers beginning as follows:1, ...

  10. leetcode第22题--Merge k Sorted Lists

    problem:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its compl ...