[Zope3-dev] i18n, unicode, and the underline

Shane Hathaway shane@zope.com
Tue, 15 Apr 2003 09:48:58 -0400


Martijn Faassen wrote:
> Shane Hathaway wrote:
> [snip]
> 
>>So, everyone, aren't there any other examples of binary strings mixing 
>>unexpectedly with Unicode?  If not, surely the "u" prefix is unnecessary.
> 
> 
> Why would the u prefix help with this anyway? You'd still have binary strings
> mixing unexpectedly with unicode, u prefix for literals or not.
> 
> Of course these problems exist. It's our job as Zope 3 framework developers
> to take these problems out of the user's hands, give them unicode
> to work with, and let the framework take care of encoding issues as much
> as possible. That way experts only have to worry about it in a few isolated
> places, instead of developers worrying about it everywhere.

Because Unicode support is in transition, it's not quite that simple, 
but we're not in a bad situation either.  Here is what I've concluded 
from this discussion:

- Python Unicode support is headed the same direction as Java Unicode 
support.

- There is no need to prefix all strings with "u".

- We're still going to have spurious bugs, but we expect them to be 
special cases.  For example, expressions like this will fail intermittently:

u"The OID of obj is %s" % obj._p_oid

... but of course this expression is wrong; it should use repr().  It's 
also for developers only.

Shane

P.S. I'd reply to each of your posts but I think you understood better 
each time you posted, so I don't think I have to write very much. :-)