Decoding a String Containing Percentage(%)

java

Solution

It doesn't look like your string is encoded correctly...

Maybe you should ensure it is properly encoded first?

For example, the encoded character representation for `%` is `%25`...

So please try decoding `Hello%25%25%26%26%24%24` instead, and see what you get :)

Problem

I am trying to decode a `String` that Contains (%) percentage, it's throwing an Exception ``` Exception:URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "%&" ``` My Code: ``` public class DecodeCbcMsg { public static void main(String[] args) throws UnsupportedEncodingException { String msg="Hello%%&&$$"; String strTMsg = URLDecoder.decode(msg,"UTF-8"); System.out.println(strTMsg); } ```

Original source