Django

Code

Ticket #5867 (closed: invalid)

Opened 3 years ago

Last modified 3 years ago

Python default encoding would be _really_ useful in Unicode documentation

Reported by: develbob@gmail.com Assigned to: nobody
Milestone: Component: Documentation
Version: SVN Keywords: unicode default encoding
Cc: develbob@gmail.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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:

# sitecustomize.py
# this file can be anywhere in your Python path,
# but it usually goes in ${pythondir}/lib/site-packages/
import sys
sys.setdefaultencoding('iso-8859-1')

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 http://www.diveintopython.org/xml_processing/unicode.html.

Attachments

Change History

11/03/07 14:12:56 changed by Armin Ronacher

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

11/03/07 19:01:55 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to invalid.

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.


Add/Change #5867 (Python default encoding would be _really_ useful in Unicode documentation)




Change Properties
Action