Description: Decode GeoIP results with the correct encoding to avoid crashes
Author: Miguel Landaeta <miguel@miguel.cc>
Forwarded: no
Bug-Debian: http://bugs.debian.org/594146
Last-Update: 2011-04-24

--- namebench-1.3.1+dfsg.orig/libnamebench/geoip.py
+++ namebench-1.3.1+dfsg/libnamebench/geoip.py
@@ -57,6 +57,8 @@ def GetFromMaxmindJSAPI():
   h = httplib2.Http(tempfile.gettempdir(), timeout=10)
   unused_resp, content = h.request('http://j.maxmind.com/app/geoip.js', 'GET')
   keep = ['region_name', 'country_name', 'city', 'latitude', 'longitude', 'country_code']
+  # GeoIP lookups results are encoded in latin1, please see http://bugs.debian.org/594146
+  content = content.decode('ISO-8859-1')
   results = dict([x for x in re.findall("geoip_(.*?)\(.*?\'(.*?)\'", content) if x[0] in keep])
   results.update({'source': 'mmind'})
   if results:
