Message85881
This issue is caused by compile() behavior.
Following sample is in codepage 932.
>>> 'あ'
'\x82\xa0' # OK - 'あ' is '\x82\xa0' in cp932
>>> u'あ'
u'\u3042' # OK - u'あ' is '\u3042' in UCS-2
compile as byte string.
>>> c = compile("'あ'", 'test', 'single')
>>> exec c
'\x82\xa0' # OK
>>> c = compile("u'あ'", 'test', 'single')
>>> exec c
u'\x82\xa0' # NG!!!
compile as unicode string.
>>> c = compile(u"'あ'", 'test', 'single')
>>> exec c
'\xe3\x81\x82' # NG!!!
>>> c = compile(u"u'あ'", 'test', 'single')
>>> exec c
u'\u3042' # OK
compile as byte string with pep 0263
>>> c = compile("# coding: mbcs\n'あ'", 'test', 'single')
>>> exec c
'\x82\xa0' # OK
>>> c = compile("# coding: mbcs\nu'あ'", 'test', 'single')
>>> exec c
u'\u3042' # OK |
|
Date |
User |
Action |
Args |
2009-04-12 00:45:55 | methane | set | recipients:
+ methane, kbk, sgala, ajaksu2 |
2009-04-12 00:45:54 | methane | set | messageid: <1239497154.87.0.635159253865.issue1542677@psf.upfronthosting.co.za> |
2009-04-12 00:45:54 | methane | link | issue1542677 messages |
2009-04-12 00:45:53 | methane | create | |
|