1

有人知道从资产目录中的文本文件读取时显示“®”符号的最佳方式吗?我尝试用 &® 或 ® 或 \u00AE 替换“®”符号,但这些都不起作用。

将其定义为html的唯一解决方案是什么?

这是我用来从资产中读取文本文件的代码:

    mTextViewTermsConditions = (TextView) findViewById(R.id.textView_terms_conditions);

    StringBuffer stringBufferEula = new StringBuffer();

    try
    {
        InputStream inputStream = getAssets().open("eula");

        BufferedReader f = new BufferedReader(new InputStreamReader(inputStream));

        String line = f.readLine();

        while (line != null)
        {
            Logger.d(line);

            stringBufferEula.append(line);

            line = f.readLine();
        }

    }
    catch (IOException e)
    {
        Logger.e(e.toString());
        e.printStackTrace();
    }

    mTextViewTermsConditions.setText(stringBufferEula);
4

2 回答 2

4

这是一个编码问题。确保您的资产文件以 UTF-8 编码存储。

于 2013-03-06T22:28:42.107 回答
0

感谢上面的 Ted Hopp 回答:确保文本文件采用 UTF-8 编码。

于 2013-03-06T22:16:55.107 回答