Reputation: 8231
I am trying to unescape a URL in java.
Is there some tool or library for that ?
example : filter=Screen+Refresh+Rate%7C120HZ%5EScreen+Size%7C37+in.+to+42+in.
I need this in the normal form.
Upvotes: 5
Views: 2977
Reputation: 12509
URLDecoder.decode(String s,"utf-8")
will work if s
is encoded in application/x-www-form-urlencoded
.
String s = URLDecoder.decode("filter=Screen+Refresh+Rate%7C120HZ%5EScreen+Size%7C37+in.+to+42+in.", "utf-8");
System.out.println(s);
Output
filter=Screen Refresh Rate|120HZ^Screen Size|37 in. to 42 in.
Upvotes: 9