Python新手问题:中文输出出错
分在别的区散完了,不好意思~
只有10分~
#!usr/bin/python
# helloworld.py
print 'asd你好'
print u'asd你好'
----------------------
输出:
asdf浣犲ソ
Traceback (most recent call last):
File "E:\HELLOW~1.PY", line 5, in <module>
print u"asd浣犲ソ"
UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-4: ordinal not in range(128)
问题:
1 为什么输出的是GB2312码?即使我把这个文件代码页转成了UTF-8也一样?
2 为什么第二个强制Unicode会出错?
谢谢了 :-)
环境: Python 2.5 , Windows Server 2003 简体中文版 + SP1