Ian Bicking: the old part of his blog

Re: The Illusive setdefaultencoding

Thank you for posting this. Very helpful. I wound up modifying site.py in python2.4 by changing encoding from "ascii" to "utf-8" in the setencoding() function. Voila! utf-8 from python command line.

tn$ python

System Message: WARNING/2 (<string>, line 4)

Block quote ends without a blank line; unexpected unindent.

Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.getdefaultencoding() 'utf-8' >>>

Then I needed to change the Pydev editor encodings to UTF-8 (Window->Preferences->General->Workspace->Text file encoding in Eclipse 3.2.1). Then I needed to change the run settings in Pydev (Window->Run->Common (tab)->Console Encoding) to UTF-8. Works perfectly now.

Thanks again. Not sure why that was so difficult though...

Comment on The Illusive setdefaultencoding
by Todd