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 THRlWiTi
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.04:46:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377146818.23.0.499490281878.issue15809@psf.upfronthosting.co.za>
In-reply-to
Content
I really think this information might help, if not, I promise not to post anything else. :)

This is a sample program I run:

'''
# -*- coding: utf-8 -*-
import sys
import locale

de = sys.getdefaultencoding()
pd = locale.getpreferredencoding()
print de, pd

s1 = 'سلام'
print s1
s2 = u'سلام'
print s2
'''

I tried to run it before and after applying suggested patches.
Before applying any patch:

'''
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
ascii cp1256
ط³ظ„ط§ظ…
سلام
>>> s3 = 'سلام'
>>> s4 = u'سلام'
>>> s3
'\xd3\xe1\xc7\xe3'
>>> s4
u'\xd3\xe1\xc7\xe3'
>>> print s3
سلام
>>> print s4
ÓáÇã
>>> s = u'Русский текст'
Unsupported characters in input
'''

After applying loewis's patch:

'''
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
ascii cp1256
ط³ظ„ط§ظ…
سلام
>>> s3 = 'سلام'
>>> s4 = u'سلام'
>>> s3
'\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85'
>>> s4
u'\u0633\u0644\u0627\u0645'
>>> print s3
ط³ظ„ط§ظ…
>>> print s4
سلام
>>> s = u'Русский текст'
>>> print s
Русский текст
>>> 
'''

After applying serhiy.storchaka's patch:

'''
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
ascii cp1256
ط³ظ„ط§ظ…
سلام
>>> s3 = 'سلام'
>>> s4 = u'سلام'
>>> s3
'\xd3\xe1\xc7\xe3'
>>> s4
u'\u0633\u0644\u0627\u0645'
>>> print s3
سلام
>>> print s4
سلام
>>> s = u'Русский текст'
Unsupported characters in input
'''

My point is that printing s3 and s4 in interactive mode, should produce the same results as printing s1 and s2 from source file. Loewis's patch handled this as I expected. Also this patch solves my problem of not being able to print u'Русский текст' (that is due to my Windows locale being set to Persian, not Russian.)
History
Date User Action Args
2013-08-22 04:46:58THRlWiTisetrecipients: + THRlWiTi, loewis, terry.reedy, kbk, ned.deily, ezio.melotti, roger.serwy, r.david.murray, asvetlov, serhiy.storchaka, alex.hartwig, pradyunsg, Tomoki.Imai
2013-08-22 04:46:58THRlWiTisetmessageid: <1377146818.23.0.499490281878.issue15809@psf.upfronthosting.co.za>
2013-08-22 04:46:58THRlWiTilinkissue15809 messages
2013-08-22 04:46:57THRlWiTicreate