fj11 / ulipad

Automatically exported from code.google.com/p/ulipad
0 stars 0 forks source link

同一段代码在IDLE和ulipad运行得到不同的结果 #242

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
win7,python 2.6.5,ulipad 4.0
一个unicode:s=u'\u6211\u662f\u4e2d\u6587'
在ulipad中s.encode('utf-8')得到:
\xe6\x88\x91\xe6\x98\xaf\xe4\xb8\xad\xe6\x96\x87
在IDLE中s.encode('utf-8')得到:
我是中文

而IDLE的结果是我想要的,请问在ulipad中应该怎么做才能得到�
��文字符串?

Original issue reported on code.google.com by puhuirat...@gmail.com on 13 May 2010 at 2:00

GoogleCodeExporter commented 8 years ago
使用print语句。

Original comment by limo...@gmail.com on 13 May 2010 at 2:57

GoogleCodeExporter commented 8 years ago
s=u'\u6211\u662f\u4e2d\u6587'.encode('utf-8')
print s.decode('utf-8').encode('big5')
輸出:
我是中文

Original comment by copy0...@gmail.com on 13 May 2010 at 10:10