2.3 encoding parsing bug

Thomas Heller theller at python.net
Tue Feb 17 09:54:27 EST 2004


> "Edward K. Ream" <edreamleo at charter.net> writes:
>
>> The documentation for encoding lines at
>>
>> C:\Python23\Doc\Python-Docs-2.3.1\whatsnew\section-encodings.html
>>
>> states:
>>
>> "Encodings are declared by including a specially formatted comment in the
>> first or second line of the source file."
>>
>> In fact, contrary to the implication, the Python 2.3 parser does not look
>> for lines of the form:
>>
>> # -*- coding: <encoding> -*-
>>
>> For example, Python improperly scans the following line for an encoding
>>
>> #@+leo-ver=4-encoding=iso-8859-1.
>>
>> and reports that iso-8859-1. (note trailing dot) is an invalid encoding!
>>
>> The workaround for my app is to precede this line with the following line:
>>
>> # -*- coding: iso-8859-1 -*-
>>
>> This makes Python 2.3 happy.
>>
>> To make myself perfectly clear: Python has absolutely no right to complain
>> about comment lines that do not have the form:
>>
>> # -*- coding: <encoding> -*-
>>

Thomas Heller <theller at python.net> writes:

>
> You should probably file a bug report for this.

Oops, I saw you did already.

Thomas



More information about the Python-list mailing list