Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unescape url in java

Tags:

java

url

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.

like image 515
Roman Avatar asked Sep 18 '11 12:09

Roman


1 Answers

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.
like image 116
Sahil Muthoo Avatar answered Sep 28 '22 23:09

Sahil Muthoo