I am writing a .py file that contains strings from multiple charactersets, including English, Spanish, and Russian. For example, I have something like:
string_en = "The quick brown fox jumped over the lazy dog."
string_es = "El veloz murciélago hindú comía feliz cardillo y kiwi."
string_ru = "В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!"
I am having trouble figuring out how to encode my file to avoid generating syntax errors like the one below when my file is run:
SyntaxError: Non-ASCII character '\xc3' in file example.py on line 128, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
I've tried adding # -*- coding: utf-8 -*-
to the beginning of my file, but without any luck. I've also tried marking my strings as unicode (i.e. string_en = u'The quick brown fox jumped over the lazy dog."
), again unsuccessfully.
Is it possible to include characters from different Python codecs in one file, or am I attempting to do something that is not allowed?