java乱码怎么处理?
这是我的java代码public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
StringBuffer sb = new StringBuffer("http://www.);
URL url = new URL(sb.toString());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// connection.setRequestProperty(arg0, arg1);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputline = in.readLine();
inputline=URLDecoder.decode(inputline, "utf-8");
System.out.println(inputline);
}
就这一个方法,是查询手机归属地,但是返回的结果汉字都是乱码,在别人机器上都没乱码,但是我的eclipse编码格式已经给设成utf-8了啊,怎么回事???