#21996: UnicodeDecodeError when calling GeoIP.country
-------------------------------------------------+--------------------
     Reporter:  Florent Messa <florent.messa@…>  |      Owner:  nobody
         Type:  Bug                              |     Status:  new
    Component:  GIS                              |    Version:  1.6
     Severity:  Normal                           |   Keywords:
 Triage Stage:  Unreviewed                       |  Has patch:  0
Easy pickings:  0                                |      UI/UX:  0
-------------------------------------------------+--------------------
 GeoIP.country('IP') raises an UnicodeDecodeError when dealing with
 countries with accents.

 For example:

 {{{
 g = GeoIP()
 g.country('200.7.49.81')
 }}}

 Should returns "Curaçao" instead:

 {{{
 In [2]: g = GeoIP()

 In [3]: g.country('200.7.49.81')
 ---------------------------------------------------------------------------
 UnicodeDecodeError                        Traceback (most recent call
 last)
 <ipython-input-3-3f21b2954917> in <module>()
 ----> 1 g.country('200.7.49.81')

 /Users/thoas/Sites/Python/Ulule/.ven/ulule/lib/python2.7/site-
 packages/django/contrib/gis/geoip/base.pyc in country(self, query)
     193         # Returning the country code and name
     194         return {'country_code' : self.country_code(query),
 --> 195                 'country_name' : self.country_name(query),
     196                 }
     197

 /Users/thoas/Sites/Python/Ulule/.ven/ulule/lib/python2.7/site-
 packages/django/contrib/gis/geoip/base.pyc in country_name(self, query)
     179         if self._country:
     180             if ipv4_re.match(query):
 --> 181                 return GeoIP_country_name_by_addr(self._country,
 enc_query)
     182             else:
     183                 return GeoIP_country_name_by_name(self._country,
 enc_query)

 /Users/thoas/Sites/Python/Ulule/.ven/ulule/lib/python2.7/site-
 packages/django/contrib/gis/geoip/prototypes.pyc in _err_check(result,
 func, cargs)
     103     def _err_check(result, func, cargs):
     104         if result:
 --> 105             return result.decode()
     106         return result
     107     func.restype = c_char_p
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21996>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/082.f33e17d93966c20d3a61af4f440a5910%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to