[tor-commits] [onionoo/master] Handle UTF-8 characters in GeoIP lookup results.

karsten at torproject.org karsten at torproject.org
Sun Jan 4 08:48:18 UTC 2015


commit 361c56c84f4f52fad0f2ccd8d28e7c4ece800869
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Dec 17 16:13:08 2014 +0100

    Handle UTF-8 characters in GeoIP lookup results.
    
    Bugfix on a96e55c where we started storing GeoIP lookup results in details
    statuses but forgot to handle UTF-8 characters correctly.
---
 .../org/torproject/onionoo/docs/DetailsStatus.java |   24 ++++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/DetailsStatus.java b/src/main/java/org/torproject/onionoo/docs/DetailsStatus.java
index 96b01c2..f38d7e8 100644
--- a/src/main/java/org/torproject/onionoo/docs/DetailsStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/DetailsStatus.java
@@ -362,51 +362,51 @@ public class DetailsStatus extends Document {
 
   private String country_name;
   public void setCountryName(String countryName) {
-    this.country_name = countryName;
+    this.country_name = escapeJSON(countryName);
   }
   public String getCountryName() {
-    return this.country_name;
+    return unescapeJSON(this.country_name);
   }
 
   private String region_name;
   public void setRegionName(String regionName) {
-    this.region_name = regionName;
+    this.region_name = escapeJSON(regionName);
   }
   public String getRegionName() {
-    return this.region_name;
+    return unescapeJSON(this.region_name);
   }
 
   private String city_name;
   public void setCityName(String cityName) {
-    this.city_name = cityName;
+    this.city_name = escapeJSON(cityName);
   }
   public String getCityName() {
-    return this.city_name;
+    return unescapeJSON(this.city_name);
   }
 
   private String as_name;
   public void setASName(String aSName) {
-    this.as_name = aSName;
+    this.as_name = escapeJSON(aSName);
   }
   public String getASName() {
-    return this.as_name;
+    return unescapeJSON(this.as_name);
   }
 
   private String as_number;
   public void setASNumber(String aSNumber) {
-    this.as_number = aSNumber;
+    this.as_number = escapeJSON(aSNumber);
   }
   public String getASNumber() {
-    return this.as_number;
+    return unescapeJSON(this.as_number);
   }
 
   /* Reverse DNS lookup result: */
 
   private String host_name;
   public void setHostName(String hostName) {
-    this.host_name = hostName;
+    this.host_name = escapeJSON(hostName);
   }
   public String getHostName() {
-    return this.host_name;
+    return unescapeJSON(this.host_name);
   }
 }



More information about the tor-commits mailing list