1
有人知道從資產目錄中的文本文件讀取時顯示「®」符號的最佳方式嗎?我嘗試用& ®或®或\ u00AE替換「®」符號,但這些都不起作用。如何在assets目錄下的文本文件中顯示「®」?
是將它定義爲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);
確保文本文件的編碼是UTF-8。什麼是印刷而不是®符號? – 2013-03-06 21:55:14
這個垃圾標誌顯示的不是「®」: 我編碼爲UTF-8,它的工作原理完美,謝謝! – 2013-03-06 22:13:06
@TedHopp你應該添加,作爲一個答案,使OP可以接受它:) – 2013-03-06 22:15:43