Sublime Forum

Encoding Issue for Python3

#1

My codes with Python 3.6 could build successfully in terminal and other IDE but not in Sublime Text 3. They use the same interpreter.
The traceback is about UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2.
I have set the default encoding with utf-8 and saved all the source files into utf-8, but it still doesn’t work.

0 Likes

#2

Did you add # encoding: utf-8 at the top of every Python file?

0 Likes

#3

Yes I have. The code could build successfully in terminal and other IDE but not in Sublime Text 3, which makes me confused.

0 Likes

#4

you’re using the built in Python build system?

0 Likes

#5

I use Python3, which indicates the same interpreter with terminal use.

0 Likes