[英]How to decode the unicode char in Java string?
在我的android項目中,我需要使用TextView顯示文本,但是我對以下字符串有一個非常糟糕的問題。 請幫助我的人。
這是我的java字符串:
TRAI floats new paper on \\u0027Net Neutrality\\u0027: Lists disadvantages of zero-rating plans
它在我的TextView中顯示如下:
TRAI floats new paper on \u0027Net Neutrality\u0027: Lists disadvantages of zero-rating plans
我希望它顯示如下:
TRAI floats new paper on 'Net Neutrality': Lists disadvantages of zero-rating plans"
我該怎么辦 ? 提前致謝!
更新:
我已經嘗試過這段代碼,但不適合我。
title.setText(Html.fromHtml(news.getTitle()).toString())
我想為所有'\\ uxxxx'提供解決方案,比如chars,而不是'\\ u0027'。
不要讓后座加倍:
String s = "TRAI floats new paper on \u0027Net Neutrality\u0027: Lists disadvantages of zero-rating plans";
這將具有以下價值:
TRAI floats new paper on 'Net Neutrality': Lists disadvantages of zero-rating plans
采用:
textView.setText(Html.fromHtml("unicode_character");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.