Sublime Text 3控制台中的Unicode编码错误 [英] Unicode Encode Error in Sublime Text 3 console

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

问题描述

我总是得到一个

'UnicodeEncodeError:'ascii'编解码器无法在位置0编码字符'\ xf6':序数不在range(128)范围内

'UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 0: ordinal not in range(128)'

. 我正在使用Anaconda Python Builder来构建系统.使用内置的"python"构建系统运行完美(即可以很好地打印出非ASCII字符),并且从终端运行脚本也可以正常运行(我在Mac OS Sierra上运行脚本).

in the sublime text 3 console when trying to print a non-ascii character. I'm using Anaconda Python Builder to build the system. Building the system with the built-in "python" runs perfectly (i.e. prints out non-ascii characters fine) and also running the script from the terminal works fine (i'm running the script on Mac OS Sierra).

我认为问题一定与Anaconda Python Builder有关,并且我认为将默认编码添加到Anaconda.sublime-settings可能会有所帮助,但没有帮助:-(这是我的anaconda用户设置文件:

I assume the problem must have something to do with the Anaconda Python Builder and I thought adding the default encoding to the Anaconda.sublime-settings might help, but it doesn’t :-( Here is my anaconda user settings file:

{ "python_interpreter":"/usr/local/bin/python3.6", "anaconda_linting":否, "pep8":否, "default_encoding":"UTF-8" }

{ "python_interpreter": "/usr/local/bin/python3.6", "anaconda_linting": false, "pep8": false, "default_encoding": "UTF-8" }

如果您能在此问题上为我提供帮助,我将不胜感激,因为我正在寻找为期两天的解决方案,但均未成功:-(

I would very much appreciate if you could help me along in this matter as I’m searching for a solution for two days now without success :-(

谢谢! 克里斯

推荐答案

好的,我找到了一种方法:

Alright, I found a way to do it:

更改该EnvironmentSettings插件的用户设置,如下所示:

Change the user settings for that EnvironmentSettings plugin to look like this:

{ "env":{ 达尔文":{ "LC_ALL":"en_US.UTF-8" } } }

{ "env": { "Darwin": { "LC_ALL": "en_US.UTF-8" } } }

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

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