[Zope3-dev] test errors due to ascii defaultencoding assumption

Jim Fulton jim at zope.com
Fri Oct 21 15:42:07 EDT 2005


Dieter Maurer wrote:
> Tim Peters wrote at 2005-10-19 15:15 -0400:

...

> Nowadays, life is hell without a sensible "setdefaultencoding":

True, but to many things would break if we set the default encoding to
disabled. :)

>   Many isolated modules intersperse unicode in an otherwise
>   "string" dominated world causing wide spread
>   UnicodeDecodingErrors.

Fortunately, Zope 3 is not a string dominated world.  All "text"
is unicode for Zope 3.  As a result, we have had very few problems.

It would have been easier if Python didn't automatically
promote strings to unicode, thus making it easier to detect string
missuse, but, unfortunately, it's too late to change that.

>>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.
> 
> 
> Hopefully only after Python cleaned up the separation
> between text and binary strings.

This is really an application problem.  Applications should
not mix strings and unicode.  With a little discipline, this is
easier to do than one might expect.

> Otherwise, I would be forced to maintain my private Python
> version (with "setdefaultencoding").

Well, you shouldn't need to do this for Zope 3.  At some point,
we need to figure out how to clean this up for Zope 2.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list