Try this, I was going to but didn't have time. It's an experiment to set the default encoding to utf-8, if my theory is correct the problem will go away.
I'm attaching 2 files: default_encoding.c setup.py
It will build a trivial Python extension that forces the default encoding to be utf-8, it's what I alluded to in my earlier comment.
Build it like this:
% python setup.py build
It will generate a python module default_encoding_utf8.so under build/lib*
Make sure default_encoding_utf8.so is in your Python path.
Merely importing the module will reset the default encoding to utf-8, e.g.:
$ python Python 2.7.3 (default, Aug 9 2012, 17:23:57) [GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.getdefaultencoding() ascii >>> import default_encoding_utf8 >>> print sys.getdefaultencoding() utf-8
Then make sure you import default_encoding_utf8 as early in the import process as possible. Run the test. Did the problem go away?
Try this, I was going to but didn't have time. It's an experiment to set the default encoding to utf-8, if my theory is correct the problem will go away.
I'm attaching 2 files: default_encoding.c setup.py
It will build a trivial Python extension that forces the default encoding to be utf-8, it's what I alluded to in my earlier comment.
Build it like this:
% python setup.py build
It will generate a python module default_ encoding_ utf8.so under build/lib*
Make sure default_ encoding_ utf8.so is in your Python path.
Merely importing the module will reset the default encoding to utf-8, e.g.:
$ python ncoding( ) encoding_ utf8 ncoding( )
Python 2.7.3 (default, Aug 9 2012, 17:23:57)
[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.getdefaulte
ascii
>>> import default_
>>> print sys.getdefaulte
utf-8
Then make sure you import default_ encoding_ utf8 as early in the import process as possible. Run the test. Did the problem go away?