URL decoding Japanese characters etc. in Java

Posted by DanieL on Stack Overflow See other posts from Stack Overflow or by DanieL
Published on 2011-01-10T22:46:06Z Indexed on 2011/01/10 22:53 UTC
Read the original article Hit count: 144

Filed under:
|
|
|

I have a servlet that receives some POST data. Because this data is x-www-form-urlencoded, a string such as ???? would be encoded to サボテン.

How would I unencode this string back to the correct characters? I have tried using URLDecoder.decode("encoded string", "UTF-8"); but it doesn't make a difference.

The reason I would like to unencode them, is because, before I display this data on a webpage, I escape & to & and at the moment, it is escaping the &s in the encoded string so the characters are not showing up properly.

© Stack Overflow or respective owner

Related posts about java

Related posts about forms