[Python-Dev] PEP 263 -- Python Source Code Encoding (original) (raw)

M.-A. Lemburg mal@lemburg.com
Tue, 26 Feb 2002 21:15:40 +0100


Guido van Rossum wrote:

> """ > Python will default to Latin-1 as standard encoding if no other > encoding hints are given. > """ I missed this. Why not default to ASCII like any decent programming language does in the absence of an explicit encoding?

Jack had the same question. The simple answer is: we need this in order to maintain backward compatibility when we move to phase two of the implementation.

Here's the longer one:

ASCII is the standard encoding for Python keywords and identifiers. There is no standard source code encoding for string literals. Unicode literals are interpreted using 'unicode-escape' which is an enhanced Latin-1 with escape semantics.

This makes Latin-1 the right choice:

-- Marc-Andre Lemburg CEO eGenix.com Software GmbH


Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/