Message197925
| Author |
serhiy.storchaka |
| Recipients |
Arfrever, benjamin.peterson, brett.cannon, eric.snow, loewis, meador.inge, serhiy.storchaka, terry.reedy, vstinner |
| Date |
2013年09月16日.18:27:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1379356061.32.0.278272788036.issue18961@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
What about first line? Currently both Python interpreter and the tokenize module decode it from UTF-8 (actually due to bug #18960 Python interprets it twice, in different encodings). PEP 263 says:
1. The complete Python source file should use a single encoding.
Embedding of differently encoded data is not allowed and will
result in a decoding error during compilation of the Python
source code.
I conclude that the first line should be decoded with the encoding specified in the second line. We first should read the first line, check if it isn't a comment or contains encoding cookie, otherwise read the second line, determine the encoding, and decode read lines. Perhaps it will untangle issue18960 too. |
|