Doyon, Jean-Francois wrote at 2007-8-24 09:36 -0400: > ... >setdefaultencoding() is apparently frowned upon ... Not sure why though.
Occasionally, a package writer expects that "str" converts to ASCII, such that try: ascii = str(unicodeStr) except UnicodeError: # non ascii can be used to check for ASCIIness. Of course, this is true only when the defaultencoding is "ASCII". Fortunately, "unicode(unicodeStr, 'ascii')" can safely be used instead. The code above actually occured in Python's "xmlrpclib". When I reported the bug, people said we should eliminate "setdefaultencoding".... But, then, they nevertheless fixed the bug... -- Dieter _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )