From 91f1eccc7a2ff1f3324c64b8b9d7d090579d405f Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Wed, 25 Jan 2012 23:17:19 +0100 Subject: [PATCH] fixed encoding issue with geocoder --- .../sap/sailing/geocoding/impl/ReverseGeocoderImpl.java | 7 ++++--- .../com.sap.sailing.server/SailingServer (No Proxy).launch | 2 +- java/com.sap.sailing.server/SailingServer (Proxy).launch | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/java/com.sap.sailing.geocoding/src/com/sap/sailing/geocoding/impl/ReverseGeocoderImpl.java b/java/com.sap.sailing.geocoding/src/com/sap/sailing/geocoding/impl/ReverseGeocoderImpl.java index a784769dc0f..9ddfd43732a 100644 --- a/java/com.sap.sailing.geocoding/src/com/sap/sailing/geocoding/impl/ReverseGeocoderImpl.java +++ b/java/com.sap.sailing.geocoding/src/com/sap/sailing/geocoding/impl/ReverseGeocoderImpl.java @@ -6,6 +6,7 @@ import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -213,7 +214,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder { * @param position * The position to be checked by the cache * @return The cached placemarks (with meta-data) sorted by distance towards position or - * null, if there's nothing cached around postion within + * null, if there's nothing cached around position within * {@link ReverseGeocoderImpl#POSITION_CACHE_DISTANCE_LIMIT the distance limit} */ private Triple> checkCache(Position position) { @@ -228,7 +229,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder { URL request = new URL(url.toString()); URLConnection connection = request.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charset.forName("UTF-8"))); JSONParser parser = new JSONParser(); JSONObject obj = (JSONObject) parser.parse(in); JSONArray geonames = (JSONArray) obj.get("geonames"); @@ -246,7 +247,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder { URL request = new URL(url.toString()); URLConnection connection = request.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charset.forName("UTF-8"))); JSONParser parser = new JSONParser(); JSONObject obj = (JSONObject) parser.parse(in); JSONArray geonames = (JSONArray) obj.get("geonames"); diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy).launch b/java/com.sap.sailing.server/SailingServer (No Proxy).launch index c9760f19479..6cedb984fb8 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy).launch @@ -24,5 +24,5 @@ - + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy).launch b/java/com.sap.sailing.server/SailingServer (Proxy).launch index c1ed3d7bb70..0e1fc14297b 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy).launch @@ -24,5 +24,5 @@ - +