[Python-bugs-list] [ python-Bugs-683486 ] Tutorial: info on Source Code Encoding is missing

SourceForge.net noreply@sourceforge.net
Thu, 22 May 2003 00:57:45 -0700


Bugs item #683486, was opened at 2003-02-09 12:50
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=683486&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Roman Suzi (rnd0110)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Tutorial: info on Source Code Encoding is missing

Initial Comment:
(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

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=683486&group_id=5470