On Oct 20, 9:50 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote:
> DON'T do that. Really. Changing the default encoding is a horrible, > horrible hack and causes a lot of problems. I'm not convinced. I've read all of the posts and web pages and blog entries decrying this practice over the last several years, but as far as I can tell the actual harm that can result is limited (as long as you set it to utf-8) and the practical benefits are substantial. This is a pattern that I have no problem using: import sys reload(sys) sys.setdefaultencoding("utf-8") The reason this doesn't cause too much harm is that anything that would have worked with the original default encoding ('ascii') will also work with the new utf-8 default encoding. As far as I've seen from the aforementioned mailing list threads and blog posts and so on, the worst thing that has ever happened as a result of this technique is that something works for you but fails for someone else who doesn't have this stanza. (http://tarekziade.wordpress.com/2008/01/08/ syssetdefaultencoding-is-evil/ .) That's bad, but probably just including this stanza at the top of the file that you are sharing with that other person instead of doing it in a sitecustomize.py file will avoid that problem. Regards, Zooko -- http://mail.python.org/mailman/listinfo/python-list