Android的解析在JSON响应特殊字符 [英] Android parse special characters in json response
问题描述
在我的Android应用程序,我从一个PHP URL JSON响应字符串。从响应我得到一些酒店名称以撇号
,我得到&放大器;#039
字符而不是撇号
。我怎样才能解析与Android的特殊字符的酒店? 我可以看到在浏览器中的撇号,但在Android的logcat中都看不到。
我曾尝试 jresponse = URLEn coder.en code(jresponse,UTF-8);
,但我无法让撇号
酒店名称。
这是在响应中的饭店的名称之一。
我看到浏览器下面。 {ID:12747,
名:奥斯卡
....
}
但在logcat中: ID 12747
奥斯卡的名字和放大器;#039;
您可以尝试的Html类。例如: -
jresponse = Html.fromHtml(jresponse);
In my Android application I get JSON response string from a PHP url. from the response I get some hotel names with apostrophe
, I get '
character instead of apostrophe
. How can I parse the hotel with special characters in android? I can see the apostrophe in the browser but could not see in android logcat.
I have tried jresponse = URLEncoder.encode(jresponse,"UTF-8");
but I could not get apostrophe
for hotel name.
This is the one of the hotel name in the response.
I see the following in browser.
{"id":12747,
"name":"Oscar's",
....
}
But in the logcat:
id 12747
name Oscar's
You can try Html class. eg :- jresponse = Html.fromHtml(jresponse);
这篇关于Android的解析在JSON响应特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!