[Zope3-dev] i18n, unicode, and the underline
Guido van Rossum
guido@python.org
Fri, 11 Apr 2003 12:23:13 -0400
> i am assuming "s" is logically equivalent to u"s"
Correct. They even compare equal in Python:
>>> u"foo" == "foo"
True
>>>
> from what i understand the po files contain these strings as indexes and
> so does it matter if the index is a unicode string or an ascii string ?
No, because they compare equal, Unicode keys and ASCII strings are
completely equivalent:
>>> d = {"foo": 42, u"bar": "hello"}
>>> d[u"foo"]
42
>>> d["bar"]
'hello'
>>>
> at run time _() should simply substitute whatever is in the po database
> ? (i know there is no such thing as a dumb question ;)
The only time you get in trouble is when a non-Unicode string contains
non-ASCII characters.
--Guido van Rossum (home page: http://www.python.org/~guido/)