[Zope-Coders] unicode question

Steve Alexander steve@cat-box.net
Fri, 05 Oct 2001 14:51:57 +0100


How much should we be supporting unicode in Zope at present?

In some code I'm writing for the ZCatalog API, I want to see whether an 
argument is a string or a sequence.

My first thought was to use:

   if isinstance(names, types.StringType):
       names=(names,)

However, this won't work if "names" happens to be a unicode string.

So, should I add two if clauses?

   if isinstance(names, types.StringType):
       names=(names,)
   if isinstance(names, types.UnicodeType):
       names=(names,)

--
Steve Alexander