[Python-Dev] PEP 263 in the works (Non-ASCII characters in test_pep277.py in 2.3)

M.-A. Lemburg mal@lemburg.com
Mon, 07 Oct 2002 19:24:28 +0200


Now that I can edit UTF-8 directly, I find a "feature" made
possible by the PEP 263 support of Python 2.3 rather
puzzling:

Let's say I edit a file testencoding.py in XEmacs with UTF-8
support:

# -*- coding: utf-8; -*-
# comment =E4=F6=FC
s =3D "=E4=F6=FC"
u =3D u"=E4=F6=FC"
print s
print u.encode('latin-1')
print 'works !'

With Python 2.3 this prints:

=C3=A4=C3=B6=C3=BC
=E4=F6=FC
works !

I would have expected that s turns out as "=E4=F6=FC" using print,
since that's how I wrote it in the source file.

This suggests to me that mixing string and Unicode literals
using non-ASCII characters in a single file should probably
be avoided.

--=20
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/