【发布时间】:2011-12-25 05:42:57
【问题描述】:
我有一个问题,即使我使用的是 utf-8 编码,webview 中的磅符号也会损坏。它显示为一些 A^£(上限在 A 的顶部)。 这是我正在使用的代码:
aboutustext = (WebView) findViewById(R.id.aboutustext);
String text = "<div style='color:#878787; padding:5px 5px 5px 5px;'><p>Rathbone Brothers Plc, through its subsidiaries, is one of the UKs leading providers of investment management services for private clients, charities and professional advisers.</p>";
text += "<p>Key facts about Rathbone Brothers Plc:</p>";
text += "<ul><li>FTSE 250 listed company </li>";
text += "<li><a href='http://www.rathbonesra2010.com' target='_blank'>Online 2010 report and accounts</a></li>";
text += "<li>A heritage dating back to 1742</li><li>11 offices across the UK with an offshore presence in Jersey</li>";
text += "<li>170 experienced investment professionals</li><li>£16.36 billion of funds under management* </li><li>Over 35,000 clients</li>";
text += "<li>Rathbone Investment Management Limited and Rathbone Pension & Advisory Services Limited are authorised and regulated by the <a href='http://www.fsa.gov.uk/'>Financial Services Authority</a></li>";
text += "</ul><p>Our success and reputation is built on the simple, but increasingly rare, commitment to superior client service as well as state-of-the-art administrative systems. We have no ties to banks or large financial institutions, giving you a whole-of-market and objective perspective on your investments. This, together with direct access to you investment manager, results in an investment portfolio that will meet your requirements.</p>";
text += "<p>If you would like to know more about the funds which we offer, please visit the <a title='Rathbone Unit trust Management Website' href='http://www.rutm.com/' target='_blank'>Rathbone Unit Trust Management </a></p>";
text += "<p>* Funds under management as of 30 June 2011</p></div>";
try {
aboutustext.loadData(URLEncoder.encode(text,"utf-8").replaceAll("\\+"," "),
"text/html", "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
可能是什么问题?
【问题讨论】:
标签: android utf-8 webview android-webview url-encoding