News for hackers. Stuff that matters.
Re:Setting The Default Encoding In Python by binarycrusader on Sunday June 09, 2013 @04:37PM (#5850476)
Please don't do this!

Especially inside of a python module intended to be imported by others.

There's a very good reason why the defaultencoding is removed from the Python namespace and you have to resort to hackery to access it.

  http://ziade.org/2008/01/08/syssetdefaultencoding-is-evil/
You should be handling encode/decode explicitly; not resorting to changing the default system encoding. You will break other consumers.

As the other poster said, just move to Python 3 and stop worrying about this mess.

Re:Setting The Default Encoding In Python by toyg on Sunday June 09, 2013 @04:14PM (#5850382)
If you do this, you should probably also use encoding declarations as per PEP 263 [1].

Or you could use Python 3 and stop worrying.

[1] http://www.python.org/dev/peps/pep-0263/

Re:Setting The Default Encoding In Python by geekforbrains on Monday June 10, 2013 @12:31PM (#5855445)
Ha ha, thanks for linking to this old post. For the record, this was meant to be a quick fix to solve some encoding issues we had on our live site.

I agree that setting global state is a bad idea. However, client satisfaction is more important than a temporary hack.

Re:Setting The Default Encoding In Python by joeyespo on Thursday June 13, 2013 @01:00PM (#5875141)
Ah, didn't realize it was a year old. I was just going through your blog and thought this was interesting! Agreed, changing global state is bad. This is an exceptional thing to do.
Re:Setting The Default Encoding In Python by daGrevis on Monday June 10, 2013 @03:39AM (#5852925)
You change the global state — it's bad.