0
我想從我的android程序下載一個網頁。但網頁是希臘語(),我只得到???????作爲回報。希臘編碼在Android與HttpClient
class RequestTask extends AsyncTask<String, String, String>{
@Override
protected String doInBackground(String... uri) {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response;
String responseString = null;
try {
response = httpclient.execute(new HttpGet(uri[0]));
StatusLine statusLine = response.getStatusLine();
if(statusLine.getStatusCode() == HttpStatus.SC_OK){
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.getEntity().writeTo(out);
out.close();
responseString = out.toString();
} else{
//Closes the connection.
response.getEntity().getContent().close();
throw new IOException(statusLine.getReasonPhrase());
}
} catch (ClientProtocolException e) {
//TODO Handle problems..
} catch (IOException e) {
//TODO Handle problems..
}
return responseString;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
//Do anything with response..
}
}
鏈接到Web服務器是: http://www.cysms.eu/anagram/android/getWR.php
能否請你幫我如何得到正確的希臘文?
問候, 尼科斯
文章的網址,所以我們可以看看。 – greenapps 2014-10-07 06:54:11
添加了鏈接。謝謝 – Nicos 2014-10-07 07:35:10
我們應該看到:ΝΕΦΤΑΚΙ還是ΜΑΣΟΥΡΙ? Firefox如何顯示ΝΕΦΤΑΚΙ,但要查看源代碼,請參閱ΜΑΣΟΥΡΙ?你不能製作更逼真的網頁嗎?對於一個單詞和只有一個希臘字符來說,這不是沒有趣味。此外我沒有有效的HTML頁面。請製作一個體面的頁面。 – greenapps 2014-10-07 08:00:05