Serhiy Storchaka added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15809>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to