加急!Google Map 返回总是英文是怎么回事啊?
http://maps.googleapis.com/maps/api/geocode/xml?address=%E5%8C%97%E4%BA%AC%E5%A4%A9%E5%AE%89%E9%97%A8&sensor=false
调用上面那个链接,直接在浏览器中得到的就是中文的。
但是为什么放在Android中,始终返回的是英文的呢?
有没有谁遇见过这问题
这是我的代码:
public static JSONObject getLocationInfo(String address) throws JSONException, UnsupportedEncodingException { HttpGet mHttpGet = new HttpGet("https://maps.googleapis.com/maps/api/geocode/json?address=北京天安门&sensor=false"); HttpClient mHttpClient = new DefaultHttpClient(); StringBuilder stringBuilder = new StringBuilder(); try { HttpResponse response = mHttpClient.execute(mHttpGet); HttpEntity entity = response.getEntity(); InputStream stream = entity.getContent(); int b; while ((b = stream.read()) != -1) stringBuilder.append((char) b); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return new JSONObject(stringBuilder.toString()); }