问题
I have a parser module in my application which will parse the response from a webservice and give the tag value. The tag value contains some special characters like ® etc. The problem is I could not decode the special characters to normal string. please find the sample response string below,
Apple® iPad™ Case
Please some body help me to solve this problem.
回答1:
Just Use String result = URLDecoder.decode(string, "UTF-8");
Or use this
byte[] data = Base64.decode(base64, Base64.DEFAULT);
String text = new String(data, "UTF-8");
回答2:
Use something like this
String decodedString = URLDecoder.decode(your string, "UTF-8");
来源:https://stackoverflow.com/questions/7089348/how-to-decode-string-in-android