&安培; eacute; = E:需要显示,因为它是 [英] é=é: need to show as it is

查看:126
本文介绍了&安培; eacute; = E:需要显示,因为它是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从服务器以文本格式的一些反应,它的正常工作,但在某些情况下,我没有得到的字符串,因为它是。

I am getting some response from server in text format, it's working fine but in some cases i didn't get string as it is.

说明: - 我的数据库有一个名称,如蛋糕,但是当我分析的数据是显示我 cupcak和放大器; eacute; 。我想说明,因为它是像蛋糕

Explanation:- My db have one name like cupcaké but when i parse data it's show me cupcaké. I want to show as it is like cupcaké.

我试过 URL.En code URL.De code 的帮助功能的 UTF-8 但他们没有帮助。我需要这不仅对这个角色的所有特殊字符的工作通用的解决方案。结果
这里是我jsonparser课,我可以根据需要在这一文件的变化?或什么地方?

I tried URL.Encode and URL.Decode function with the help of utf-8 but none of them helpful. I need universal solution which work for all special character not only for this character.
Here is my jsonparser class, can i need to make changes in this file? or somewhere?

HttpURLConnection conn = null;
    StringBuilder jsonResults = new StringBuilder();
    try {
        URL url = new URL(str);
        conn = (HttpURLConnection) url.openConnection();
        InputStreamReader in = new InputStreamReader(conn.getInputStream());

        // Load the results into a StringBuilder
        int read;
        char[] buff = new char[1024];
        while ((read = in.read(buff)) != -1) {
            jsonResults.append(buff, 0, read);
        }
        json = jsonResults.toString();         
    } catch (MalformedURLException e) {
        Log.e(LOG_TAG, "Error processing Places API URL", e);

如何能显示,因为它是我的屏幕上?结果
请给我任何参考或暗示。

How can i show as it is on my screen?
Please give me any reference or hint.

推荐答案

长的搜索后,我发现了一个很好的答案。这些是HTML实体,并且可以通过使用以下code显示:

After a long search, I found a good answer. These are html entities and can be shown by using the following code:

Html.fromHtml(Html.fromHtml((String) yourstring).toString());  

现在所有的HTML实体转换成实际的字符串。你可以在这里找到的更多详细信息,

Now every html entity's converted into the actual string. You can find more details here.

这篇关于&安培; eacute; = E:需要显示,因为它是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆