(I propose to add information into Tutorial on how
to specify source code encoding. Please correct
my English and maybe there is better way to
get a list of possible encodings)
2.2.2 Executable Python Scripts
...
2.2.3 Source Code Encoding
It is possible to use encodings different than ASCII
in Python
source files. The best way to do it is to put one more
special comment line right after #!-line making
proper encoding
declaration:
# -*- coding: latin-1 -*-
After that, all characters in the source file will
be treated
as belonging to latin-1 encoding, and it will be
possible
to directly write Unicode strings in the selected
encoding.
List of possible encodings could be found in the
encodings
subdirectory of Python directory.
Significant advantage could be had if using utf-8
encoding,
as it allows to use letters from many languages in
the same
file.
2.2.4
|