Hi
Dne Fri, 03 Jul 2009 10:09:06 +0200
Susanne Oberhauser
The sys.setdefaultencoding function is disabled after site initialization on purpose: http://www.python.org/dev/peps/pep-0100/
The purpose isn't clear, though.
I've found somewhere, that this function was supposed to be temporary until developers decide what should be default encoding. Unfortunately it was not removed later and is still there what only increases confusion.
There is thre fixes to this:
1. we enable in syte.py the use of the locale setting
Problem with this is that you will most likely break applications which do rely on default settings.
2. we work around the IMNSHO braindead disablement of "setdefaultencoding":
import sys, locale reload(sys) sys.setdefaultencoding(locale.getdefaultlocale()[1])
3. We scatter explicit unicode awareness to every place we possibly handle unicode strings strings.
I *strongly* opt for #1 or #2. #3 is just so plain inelegant, I refuse to do that. It's like checking return codes after exceptions have been invented.
4. Wait for python 3.0 :-). -- Michal Čihař | http://cihar.com | http://blog.cihar.com