[Stephan Richter]
> I am pretty sure that it is strongly discouraged to change the default
> encoding in site.py. Can anyone confirm this? I think based on this
> discouragement we always assume that noone changes their site.pp.

If you're running a personal Python, and are willing to deal with all
the problems it _might_ cause yourself, there's nothing wrong with
changing the default encoding (or, at least, nobody from the PSF will
arrest you).

Anyone else shouldn't touch the default encoding, period -- the
intended, industrial-strength way to deal with encodings is to use
Unicode and explicit encode/decode operations.  Fredrik Lundh
explained the reality here:

    When the Unicode type was added, people disagreed on what the
    [default] encoding should be (ASCII, ISO-8859-1, or UTF-8), so the
    setdefaultencoding hook was added so we could play with it.
    Unfortunately, nobody got around to remove it before the release.

    (to me, arguing that it's a good thing that you can use a global setting
    to control what a+b does when a is an 8-bit string and b is a unicode
    string is about as silly as arguing that it would be a good thing to have
    a global setting for controlling what a+b does if a is an integer and b is
    a string. if you want to convert between different logical types (encoded
    data and text are different things), use an explicit conversion.)

I'm sure sys.setdefaultencoding will vanish in a future Python
release, since it wasn't intended to persist beyond initial
development to begin with.
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to