I Get a long String from an Android HTTP get. The String has many Chinese words in it, so I get lots of scrambled code In my String. That makes my parser unworkable. I’ve heard about the data from server is kind of raw data. How can I translate the scrambled code to readable code (in Chinese)?
I’ve tried this following, but it doesn’t work.
String retSrc = EntityUtils.toString(response.getEntity());
byte[] queryBytes = retSrc.getBytes("Raw Data");
String Str = new String(queryBytes,"UTF-8");
Raw Data is a charset encoder?
the encoding is an ugly problem, some suggestion:
when the string get from the site, try ‘utf-8’ or ‘gbk’ to encoding.
if the string printed to the console is right, maybe the encoding is right.