I have a string in java that looks like this "''''<>!@#$%^&"
, this was escaped in javascript. I need to obtain the original string before escaping the special characters, which is "''''<>!@#$%^&*()"
.
Asked
Active
Viewed 1,374 times
-4

Matt Ball
- 354,903
- 100
- 647
- 710

user3091472
- 1
- 1
-
http://stackoverflow.com/questions/4841331/url-encode-and-decode-special-character-in-java – bsiamionau Dec 11 '13 at 14:33
-
Your question has already been answered here: http://stackoverflow.com/questions/6138127/how-to-do-url-decoding-in-java – Michaël Benjamin Saerens Dec 11 '13 at 14:35
3 Answers
1
You can use StringEscapeUtils.unescapeHtml4 for this.
For example, the string "<Français>" will become "<Français>"

pascalhein
- 5,700
- 4
- 31
- 44
0
You need to know how it was encoded to reverse it.
If it was URL encoded (which looks likely) then Java has a built in URLDecoder
class.
URLDecoder.decode(message, encoding);

Tim B
- 40,716
- 16
- 83
- 128
0
Apache Commons provides utilities for this.
org.apache.commons.lang.StringEscapeUtils.unescapeHtml(String string)
should be what you want.
Check out the API here

Dragondraikk
- 1,659
- 11
- 21