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

Barry Warsaw barry@python.org
11 Apr 2003 10:58:52 -0400


On Fri, 2003-04-11 at 09:26, Stephan Richter wrote:

> Barry is completely right with this! After a long discussion we decided to 
> have all human interface strings as unicode. Also The _() is needed for 
> translations; if Barry figures out how to do it without this, fine, if not 
> they need to stay too.

I just realized there's another reason not to like this much: we'll have
to add a type test to _() since it'll be perfect valid to use a Unicode
here too.  You can't pass a Unicode string as the first argument to the
unicode() built-in.

So you'd have to do something like:

if not isinstance(s, unicode):
   s = unicode(s, 'us-ascii')

Blech.  Eventually all strings in Python will be Unicode just like in
Jython and then we can remove all the fiddly little u's :).

-Barry