2
可能重複:
How can I Decode string?
Java: How to decode HTML character entities in Java like HttpUtility.HtmlDecode?有沒有解碼字符串的方法?
嗨,
我有串等作爲例如「&ampauml; S&amparing;」需要像這樣轉換「äså」請幫我在這裏。
在此先感謝
可能重複:
How can I Decode string?
Java: How to decode HTML character entities in Java like HttpUtility.HtmlDecode?有沒有解碼字符串的方法?
嗨,
我有串等作爲例如「&ampauml; S&amparing;」需要像這樣轉換「äså」請幫我在這裏。
在此先感謝
看一看在Apache的共享庫中的StringEscapeUtils
類。 (具體來說是unescapeHtml
method)。的[我怎麼能解碼字符串?]
import org.apache.commons.lang.StringEscapeUtils;
public class Test {
public static void main(String[] args) {
String str = "äså";
System.out.println(StringEscapeUtils.unescapeHtml(str)); // prints äså
}
}
可能重複(http://stackoverflow.com/questions/4990943/how-can-i-decode-string)你已經問過這個問題。 – 2011-02-14 18:31:28