[I18n-sig] Strawman Proposal (2): Encoding attributes

M.-A. Lemburg mal@lemburg.com
Fri, 09 Feb 2001 20:30:33 +0100

Paul Prescod wrote:
> "M.-A. Lemburg" wrote:
> >
> > ...
> >
> > Ah, ok. The encoding information will only be applied to literal
> > Unicode strings (u"text"), right ?
> No, that's very different than what I am suggesting.
> The encoding is applied to the *text file*.


The parser has no idea of what to do with Unicode input...
this would mean that we would have to make it Unicode
aware and this opens a new can of worms; not only in the case
where this encoding specifier is used.

Also, string literals ("text") would have to translate the
Unicode input passed to the parser back to ASCII (or whatever
the default encoding is) and this would break code which currently
uses strings for data or some specific text encoding.

The result would be way to much breakage.

> In the initial version, the
> only place Python would allow Unicode characters is in Unicode literals
> so currently the only USEFUL place to put those special characters is in
> Unicode literals. But Python may one day allow Unicode variable names or
> "simple string literals" and this mechanism will not change its
> definition or behavior. Only the Python grammar will change.

Sorry, Paul, but this will never happen. Python is an ASCII 
programming language and does good at it.

> The interpretation of string literals is a totally separate issue.

See above.

Marc-Andre Lemburg
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/