[I18n-sig] Unicode experience
M.-A. Lemburg
mal@lemburg.com
Fri, 07 Jul 2000 13:15:49 +0200
Toby Dickenson wrote:
>
> I'm just nearing the end of getting Zope to play well with unicode
> data. Most of the changes involved replacing a call to str, in
> situations where either a unicode or narrow string would be
> acceptable.
>
> My best alternative is:
>
> def convert_to_something_stringlike(x):
> if type(x)==type(u''):
> return x
> else:
> return str(x)
>
> This seems like a fundamental operation - would it be worth having
> something similar in the standard library?
You mean: for Unicode return Unicode and for everything else
return strings ?
It doesn't fit well with the builtins str() and unicode(). I'd
say, make this a userland helper.
BTW, could you elaborate a bit on your experience with adding
Unicode support to Zope ? Such a report would certainly make
a nice complement to the Unicode tutorial and help other
people adding Unicode support to their apps.
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/