Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1057

how to decode russian language

$
0
0

I have trying to load several sites with different languages content. And only russian content I have seen as <?> elements. Please help me to decode it to right symbols. My code samples:

RequestTask t = new RequestTask();response = t.doIt("http://google.ru"); //troubles //response = t.doIt("http://stackoverflow.com"); //ok//response = t.doIt("http://web.de/"); //ok//response = t.doIt("http://www.china.com/"); // omg, it's ok too!StatusLine statusLine = response.getStatusLine();if(statusLine.getStatusCode() == HttpStatus.SC_OK){    ByteArrayOutputStream out = new ByteArrayOutputStream();                        response.getEntity().writeTo(out);    out.close();    String response_string = new String(out.toByteArray(), "UTF-8"); 

Request code:

public class RequestTask {    public HttpResponse doIt(String... uri)     throws ConnectTimeoutException, UnknownHostException, IOException{        HttpParams params = new BasicHttpParams();        HttpConnectionParams.setConnectionTimeout(params, 6000);        HttpConnectionParams.setSoTimeout(params, 6000);        HttpClient httpclient = new DefaultHttpClient(params);        HttpResponse response = null;        Log.d(this.toString(), "HTTP GET to "+ uri[0]);        response = httpclient.execute(new HttpGet(uri[0]));        Log.d(this.toString(), "response: "+ response.getStatusLine().getReasonPhrase());        return response;    }}

Viewing all articles
Browse latest Browse all 1057

Trending Articles