appliedsec/pygeoip — Issue #1: Unicode encoded data returned as ascii encoded string.
Author: jennifere
Created: 2012-01-13 13:36:25+00:00
State: open

Reproduction Steps:
-------------------
1. Run some code which fetches a GeoIP entry with unicode characters:

gi = pygeoip.GeoIP('MyPathToGeoIPOrganizationFile')
org = gi.org_by_addr('67.215.9.186')
sorg = u'org = %s' % org

Expected output:
----------------
org = Tirabout François

Actual Output:
--------------
'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

Versions:
---------
OS: Windows Vista
Python: 2.7.2
pygeoip: 2.2

Workaround:
-----------
Force pygeoip to use unicode encoded strings as follows:
1. Create file in [PYTHON]\Lib\site-packages\sitecustomize.py with the following contents:

import sys
sys.setdefaultencoding('utf8')