Sublime Forum

Python and accented character

#1

Hello,

whenever I use an accented character in a Python file the python interpreter complains and the script won’t run. I tried to ‘file/reopen with encoding/UTF-8’ and all the other encoding values but nothing seems to work. Is it a sublime or python problem ? I’ve never had any similar problem with other languages.

In this case I used accented characters like '"á é í ó ú " inside comment blocks.

0 Likes

#2

Place:

# coding=utf-8

at first line of your script.

python.org/dev/peps/pep-0263/

0 Likes

#3

-- coding: utf-8 --

0 Likes

#4

Hello, thanks that seems to work (both solutions).
Do you think it will be possible to tell sublime text to automatic add that line whenever I create a new python file?
Maybe a snippet? What do you think?

0 Likes