我正在尝试将下一个网页内容(原样)带到我的 android 应用程序中的 TextView 中。
http://www.kavim-t.co.il/include/getXMLStations.asp?parent=56_%20_2
以下是 Chrome 与 Activity 的结果:
如您所见,问题在于希伯来语/UTF-8/Windows-1255 字符显示为“???”。
我正在使用下一个代码(使用 org.apache.http):
TextView tv = (TextView) findViewById(R.id.tv1);
HttpClient client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, HTTP.UTF_8);
HttpGet request = new HttpGet("http://www.kavim-t.co.il/include/getXMLStations.asp?parent=56_%20_2");
HttpResponse response = null;
response = client.execute(request);
BufferedReader rd = null;
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
tv.append(line);
}