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 serhiy.storchaka
Recipients THRlWiTi, Tomoki.Imai, alex.hartwig, asvetlov, ezio.melotti, kbk, loewis, ned.deily, pradyunsg, r.david.murray, roger.serwy, serhiy.storchaka, terry.reedy
Date 2013-08-22.06:08:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377151732.5.0.172361307333.issue15809@psf.upfronthosting.co.za>
In-reply-to
Content
Use cp1256 encoding in your source file. It is expected that usually your source files encoding is same as your locale encoding. In such case printing string literals and Unicode string literals produces same result (as they look in the sources).

s1 is '\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85' (u'سلام'.encode('utf-8')) and when it printed in utf-8 locale it produces "سلام", but when it printed in cp1256 locale it produces a mojibake.

When you convert your source file to cp1256 and change a header, s1 will be '\xd3\xe1\xc7\xe3' (u'سلام'.encode('cp1256')) and will produce "سلام" when printed in your cp1256 locale.
History
Date User Action Args
2013-08-22 06:08:52serhiy.storchakasetrecipients: + serhiy.storchaka, loewis, terry.reedy, kbk, ned.deily, ezio.melotti, roger.serwy, r.david.murray, asvetlov, THRlWiTi, alex.hartwig, pradyunsg, Tomoki.Imai
2013-08-22 06:08:52serhiy.storchakasetmessageid: <1377151732.5.0.172361307333.issue15809@psf.upfronthosting.co.za>
2013-08-22 06:08:52serhiy.storchakalinkissue15809 messages
2013-08-22 06:08:52serhiy.storchakacreate