Opened 10 years ago

Closed 10 years ago

#5867 closed (invalid)

Python default encoding would be _really_ useful in Unicode documentation

Reported by: develbob@… Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: unicode default encoding
Cc: develbob@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


While upgrading Django we collided upon a numberous amount of Unicode errors only to find, after looking for a long time, that there was a simple and easy way out; by setting the default encoding for Python. This can simple be done by dropping the following snipplet somewhere in the Python path:

# this file can be anywhere in your Python path,
# but it usually goes in ${pythondir}/lib/site-packages/
import sys

We feel that it would be really useful to mention this in the Unicode page of the Django documentation. The script itself we have found on

Change History (2)

comment:1 Changed 10 years ago by Armin Ronacher

Ugh. That causes *serious* problems. Guess why *removes* setdefaultencoding...

comment:2 Changed 10 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

Firstly, this is not a good idea. It's not recommended by the Python maintainers, for a start. I consider it a bug in "Dive Into Python" that it's recommended there, since as soon as you start making changes like this, your code becomes non-portable.

Secondly, this isn't a bug in Django.

Note: See TracTickets for help on using tickets.
Back to Top