1.按步骤设置eclipse编码:
a. window->preferences->general->editors->text editors->spelling->encoding->UTF-8
b. window->preferences->workspace->text file encoding->UTF-8(注:我的是eclipse3.2.1SDK,spelling里面没有encoding设置项)
c. 打开eclipse安装目录->eclipse.ini(其内容为:-vmargs-Xms40m-Xmx256m),末行行尾加上: -Dfile.encoding=UTF-8(即加后文件内容为:-vmargs-Xms40m-Xmx256m- Dfile.encoding=UTF-8)
2. py文件最顶部加入编码声明:
#coding=utf-8
Done!
参考链接:http://robin.sh/html/733_python-eclipse-encoding.html