PyCharm控制台编码错误 [英] PyCharm console encoding errors

查看:227
本文介绍了PyCharm控制台编码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我从Eclipse(LiClipse)迁移到PyCharm。有一个问题根本不是Eclipse。编码问题,至少在尝试打印某些东西到控制台时。

Recently I've migrated from Eclipse (LiClipse) to PyCharm. There is one problem which wasn't with Eclipse at all. Problem in encoding, at least, when trying to print something to console.

我在IDE和LiClipse中都尝试过这个脚本,但是在Pycharm中会出现错误。

I've tried this script in both IDE's and in LiClipse it print's soup but in Pycharm raises error.

在尝试打印facebook的汤(html)时出错:

ERROR while trying to print soup (html) of facebook:

 File "C:\Python27\lib\encodings\cp1252.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u010d' in position 9078: character maps to <undefined>

你知道问题出在哪里吗?

Do you know where is the problem?

推荐答案

对于PyCharm控制台输出,正确设置IDE和项目编码非常重要(不仅仅是文件编码)。在设置窗口中搜索文件编码,并将IDE和项目编码设置为UTF-8(或其他)。

For PyCharm console output it is important to set IDE and project encoding properly (not just file encoding). Search for "File Encodings" in Settings window and set IDE and project encoding to UTF-8 (or other).

这篇关于PyCharm控制台编码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆