[Zope3-dev] Encodings in Python 2.3

Guido van Rossum guido@python.org
Mon, 05 Aug 2002 11:52:27 -0400


> In Python 2.3, non-ASCII characters in Python string literals trigger
> warnings unless the source file declares its intended encoding.  There's one
> instance of this in the Zope3 test suite:
> 
> C:\Code\Zope3\lib\python\Zope\App\Traversing\
>    tests\testConvenienceFunctions.py:202:
> DeprecationWarning: Non-ASCII character '\xa3', but no declared encoding
>   self.assertRaises(UnicodeError, lat, ('', u'123', '£23'))
> 
> It's the '£23' that triggers the warning.  Anyone care to guess which
> encoding was intended <wink>?  If nobody does, I'll declare it as Latin-1 to
> shut up the warning.

Maybe a better solution is to replace all four occurrences of the
pound sign by \xa3.  Source code encodings are nice, but ASCII source
is better.

--Guido van Rossum (home page: http://www.python.org/~guido/)