简体   繁体   中英

How can I Decode string?

I have string like "äså" that needs to be converted like "äså" so how can we do that?.

Thanks in advance.

您需要使用commons-lang StringEscapeUtils对字符串进行双转义:

StringEscapeUtils.unescapeHtml(StringEscapeUtils.unescapeHtml(string))

If nothing is working then one simplest thing you can do is enclose whatever string you have within and do a xml parse using the SAX Parser on the device. This will give you a callback to decode xml entities wherein you can replace the characters. There are a lot of places wherein you can get a map.

您可以尝试Uri.decode(yourString)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM