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

SourceForge.net noreply@sourceforge.net
Wed, 25 Jun 2003 11:43:21 -0700


Bugs item #683486, was opened at 2003-02-09 12:50
Message generated for change (Comment added) 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: Martin v. Löwis (loewis)
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

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-25 13:43

Message:
Logged In: YES 
user_id=80475

Martin, I think something like the above wording should be 
added to the tutorial.  Do you have any wording suggestions?

* Instead of latin-1, it should list the ISO number.
* The encodings directory is a subdirectory of Lib.
* The last paragraph should be replaced and instead make 
your recommendation to arrange IDLE so that it
always stores files as UTF-8 with BOM.

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

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