4

I’m always getting a

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

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).

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": 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 :-(

Thank you! Chris

Baili
  • 159
  • 2
  • 12

1 Answers1

2

Alright, I found a way to do it:

Baili
  • 159
  • 2
  • 12
  • 4
    You do not even need an external plugin. You can also edit your build system, adding `"env": {"PYTHONIOENCODING": "utf8"}`. See [this related question](https://stackoverflow.com/q/39576308/2291710). – Delgan Jul 19 '17 at 13:36