[Python-Dev] Non-ASCII characters in test_pep277.py in 2.3 (original) (raw)

M.-A. Lemburg mal@lemburg.com
Mon, 07 Oct 2002 09:56:12 +0200


Guido van Rossum wrote:

The file pep2777.py uses an encoding cookie that specifies UTF-8. Unfortunately my toolchain doesn't know about this, and displays it as Latin-1. Since the only UTF-8 is in 8-bit string literals (not Unicode literals), wouldn't it make more sense to drop the encoding cookie and use \xXX escapes in those literals?

You could, but the whole point of PEP 263 is that the source code encoding is made explicit, so removing the cookie would defeat the purpose. Note that the cookie also implicitly tests the PEP 263 implementation.

I'm not even sure this use is legal in phase 2 of PEP 263.

It is: if you use non-UTF-8 string literals in that source file, the parser will raise an exception during compilation.

-- 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/