The following is the result of my research, I hope to help you:
Java code
- SB = new StringBuffer ();
- httpentity entity = response.getentity ();
- InputStream is = Entity.getcontent ();
- BufferedReader br = new BufferedReader (
- New InputStreamReader (IS,"GB2312"));
- String data = "";
- While ((data = Br.readline ()) = null) {
- Sb.append (data);
- }
- String result = Sb.tostring ();
Java code
- The following is the redundant code, the platform will read the data according to the default encoding, thank Melode11 and Eleda pointing result = new String (Result.getbytes (), "UTF-8");
Let me explain.
Java code
- BufferedReader br = new BufferedReader (
- New InputStreamReader (IS,"GB2312"));
is read to change the source of the code, the source format is GB2312, Anyuan format read in, and then the source code to convert to the desired encoding on the line