作者alvin17 (alvin17)
看板Python
标题Re: [问题] utf-8的问题
时间Mon Feb 11 12:56:49 2008
※ 引述《Tiberius (渴望平凡的幸福)》之铭言:
: 请去改 Python25\Lib\site.py (找 def setencoding 这段码, 把原本 if 1/0 交换)
: 或者是在程式里面 reload(sys); sys.setdefaultencoding(...)
: 现在手边没有 Eclipse, 所以不确定设定 Eclipse 的 console encoding 之後能不能
: 让 Python 透过现有 locale 机制判断到, 等我有空之後装起来试试看 ...
测试结果报告大大
将site.py对应的code改成
if 1:
# Enable to support locale aware default string encodings.
import locale
loc = locale.getdefaultlocale()
if loc[1]:
encoding = loc[1]
到Eclipse + Pydev底下执行以下之code
import sys
print sys.stdout.encoding
结果为
None
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.230.5.84