[Python-3000] Issues about Python script encoding

Victor Stinner victor.stinner at haypocalc.com
Thu Oct 2 23:54:06 CEST 2008


Le Thursday 02 October 2008 22:32:43 Martin v. Löwis, vous avez écrit :
> > About the coding header, IDLE doesn't read #coding: header. Here is a fix
> > (use tokenize.detect_encoding):
> > http://bugs.python.org/issue4008
>
> Are you really sure about that? It did in the past.

Try IDLE in an ASCII terminal:
   python Tools/scripts/idle idle-3.0rc1-quits-when-run.py

(the .py file is attached to the issue).

IDLE use open(filename, 'r') without setting the encoding. io module is not 
aware of the #coding: header.

The issue is maybe related to the terminal locale since IDLE uses a "locale 
encoding" (import IOBinding; IOBinding.encoding) which is marked 
as "deprecated" in IDLE source code.

(We should use the bug tracker to discuss this issue)

-- 
Victor Stinner aka haypo
http://www.haypocalc.com/blog/


More information about the Python-3000 mailing list