[Tutor] ASCII and Unicode

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue Nov 5 11:53:01 2002


> PS: Does anybody know why sys.setdefaultencoding is deleted at the end of
> site.py?

Hello!


According to Dive Into Python:

    http://diveintopython.org/kgp_unicode.html

near the middle, the author mentions that sys.setdefaultencoding() is
supposed to be called only during Python's initialization.
sys.setdefaultencoding() is deleted to remove the temptation of trying to
call it again --- We're not supposed to try recovering
setdefaultencoding()!


The orthodox approach to change the encoding method is to touch our own
personal 'sitecustomize.py' file and plug in the setdefaultencoding() call
there.


Hope this helps!