[Zope3-dev] Re: [Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate - TALES.py:1.3

Jim Fulton jim@zope.com
Sat, 15 Jun 2002 12:49:05 -0400


Guido van Rossum wrote:
> 
> [Changing the audience]
> 
> > > I've heard this recommendation again, and I still don't understand
> > > what you expect this to buy us.  I've checked, and there's not a
> > > single non-ASCII character in the entire Zope 3 Python source, so it
> > > would have no impact.
> >
> > Not necessarily in the code, but the data we save. Let's say you mix at some
> > point some info from the source and the data storage *be it ZODB or gettext
> > file). If your strings are not in the right format you run in all sorts of
> > problems. I guess only developers who have been in unicode hell once,
> > understand... :-)
> 
> Sounds like FUD to me.  Maybe mixing string types causes problems in
> other languages, but Python's rules for combining ASCII and Unicode
> strings are designed to make mixing of the two always do the right
> thing. 

They fail miserably.

They allow program errors to go undetected until the cause of the errors
cannot be determined. I just got bitten hard by this when unicode from XML
processing leaked into HTTP response data. This promoted the HTTP response 
data to unicode, which "worked" until I decided I wanted to output image data, 
which couldn't be promoted to unicode.  

I've heard a number of horror stories like this.

This is an example where implecit is worse than explicit.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org