如何让 PyC​​harm 在其控制台中显示 unicode 数据? [英] How to get PyCharm to display unicode data in its console?

查看:25
本文介绍了如何让 PyC​​harm 在其控制台中显示 unicode 数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经切换到 PyCharm 并且使用它时玩得很开心.我为使用英语以外的语言(即希伯来语和阿拉伯语)的项目编写代码,并且需要不时调试编码.出于某种原因,PyCharm 不会在其调试控制台中显示 Unicode 字符.

I have switched over to PyCharm and have had a blast using it. I code for projects that use languages other than English (i.e. Hebrew and Arabic) and need to debug encodings once in a while. For some reason, PyCharm will not display Unicode characters in its debug console.

我已将 IDE 编码设置为 UTF-8,但没有帮助.

I have set the IDE encoding to UTF-8 but it did not help.

有什么想法吗?

推荐答案

接受的答案不再正确.在默认字体中,它们都没有区别.我刚刚解决了同样的问题,最好的解决方案是修改您的 .bash_profile(或 .zshrc)并包含以下行:

The accepted answer is no longer correct. Of the default fonts, none of them make a difference. I just spent awhile going through this same problem and the best solution is to modify your .bash_profile (or .zshrc) and include the line:

export PYTHONIOENCODING=UTF-8

理论上,您也可以将其添加到您可以在 Preferences->Build,Execution,Deployment->Python Console 中设置的环境变量中然而,这种方法似乎在我正在使用的构建中被打破了(4.0.4)

In theory, you could also add this to your Environment Variables which you can set from within Preferences->Build,Execution,Deployment->Python Console This approach, however, seems to be broken in the build I am using (4.0.4)

这篇关于如何让 PyC​​harm 在其控制台中显示 unicode 数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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