Opened 8 years ago

Closed 8 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 8 years ago by Armin Ronacher

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 8 years ago by mtredinnick

  • Resolution set to invalid
  • Status changed from new to closed

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