This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, lemburg, sjmachin, tarek
Date 2008-12-30.14:37:58
SpamBayes Score 2.2329465e-05
Marked as misclassified No
Message-id <1230647883.5.0.881475748077.issue4742@psf.upfronthosting.co.za>
In-reply-to
Content
This is a duplicate of issue4626.

Here, the content is correctly decoded with cp1252, then passed to
compile(); but compile() works on the internal utf-8 representation, and
tries to decode it again with cp1252!

Yes, the error message is overwritten. If I remove the code that sets
the "unknown encoding" exception, I get:

>>> compile(open("c:/temp/t1252.py", encoding="cp1252").read(),
"t1252.py", "exec")
SyntaxError: 'charmap' codec can't decode byte 0x9d in position 35:
character maps to <undefined>

The 0x9d explains easily:
>>> b"\x94".decode('cp1252').encode('utf8')
b'\xe2\x80\x9d'
History
Date User Action Args
2008-12-30 14:38:03amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, lemburg, sjmachin, tarek
2008-12-30 14:38:03amaury.forgeotdarcsetmessageid: <1230647883.5.0.881475748077.issue4742@psf.upfronthosting.co.za>
2008-12-30 14:37:58amaury.forgeotdarclinkissue4742 messages
2008-12-30 14:37:58amaury.forgeotdarccreate