我试图要求Gapogles大地皮使用这一源代码。
client = new DefaultHttpClient();
HttpGet get=new HttpGet(uri);
try {
HttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200 ){
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
try {
XMLReader parser = XMLReaderFactory.createXMLReader();
parser.setContentHandler(gh);
parser.parse(new InputSource(is));
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
Is the URI like this http://maps.googleapis.com:80/maps/api/geocode/xml?address=Königstraße, Berlin&sensor=false
一个例外是:非法性质!
How can I escape ä,ü,ö,ß and the blanks? I tried the java.net.URLEncoder with ISO-8859-1 as encoding without success :(
i