开发者

How to convert from HTML to UTF-8 in java

开发者 https://www.devze.com 2022-12-30 07:49 出处:网络
I have an ASCII String, with HTML entities, like: à ¨ ç I need this String to be without those entiti开发者_StackOverflow中文版es and convert them into UTF-8 chars.

I have an ASCII String, with HTML entities, like:

 à
 ¨
 ç

I need this String to be without those entiti开发者_StackOverflow中文版es and convert them into UTF-8 chars. Is there any easy way, in java to do that?

Where:

 Clazz.method("aà","UTF-8")

returns "aà"

or something like that?


Take a look at org.apache.commons.lang.StringEscapeUtils.unescapeHtml(...). Apparently it understands all character entities defined in HTML 4.

0

精彩评论

暂无评论...
验证码 换一张
取 消