[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-24 Thread wjm251
wjm251 added the comment: Got that , thank you -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-24 Thread Martin v . Löwis
Martin v. Löwis added the comment: > oh,you mentioned the PEP 263 > but I already set a header like this,you can see the attached test.py > #coding=GBK You have that in test.py, but not in the string you are giving to exec. This is really a separate source code. So you could have written exec

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-24 Thread wjm251
wjm251 added the comment: oh,you mentioned the PEP 263 but I already set a header like this,you can see the attached test.py #coding=GBK why exec choose to use utf-8 not GBK? GBK is a valid Chinese character set in python26 -- ___ Python tracker <

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread Martin v . Löwis
Martin v. Löwis added the comment: > but why it is forced to encoded to utf-8, > I think it should be encoded by the locale related encodings,not always utf-8, > for example,in GBK locale,it should use GBK to encode the unicode > object,right? Wrong. Exec'ing Unicode strings has been specified

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread wjm251
wjm251 added the comment: but why it is forced to encoded to utf-8, I think it should be encoded by the locale related encodings,not always utf-8, for example,in GBK locale,it should use GBK to encode the unicode object,right? -- ___ Python tracker

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread Martin v . Löwis
Martin v. Löwis added the comment: Oops, I meant a = "大" -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread Martin v . Löwis
Martin v. Löwis added the comment: This is not a bug, but intentional. a is a Unicode string; it does not have an encoding internally (not GBK, not UTF-8). Then, the string being exec'ed also becomes a Unicode string. exec'ing Unicode strings is confusing; try to avoid this. The semantics of

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread wjm251
wjm251 added the comment: in windows English Version and ubuntu 10.04(locale is utf-8) all have the same the behavior, am I wrong? -- ___ Python tracker ___ ___

[issue10187] exec encode unicode to utf-8 str automatically in GBK environment

2010-10-23 Thread wjm251
New submission from wjm251 : windows Xp chinese version see the attached file, the header was set to GBK,and the file is GBK encoded, but why the output was '\xe5\xa4\xa7'(it is utf-8 encoded of Chinese character "大") -- components: Library (Lib) files: test.py messages: 119482 nosy: