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.23295e-05
Marked as misclassified No
Message-id <>
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/", encoding="cp1252").read(),
"", "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')
Date User Action Args
2008-12-30 14:38:03amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, lemburg, sjmachin, tarek
2008-12-30 14:38:03amaury.forgeotdarcsetmessageid: <>
2008-12-30 14:37:58amaury.forgeotdarclinkissue4742 messages
2008-12-30 14:37:58amaury.forgeotdarccreate