STINNER Victor <[EMAIL PROTECTED]> added the comment: Hum, the problem is that IDLE asks io.open() to detect the charset whereas open() doesn't know the #coding: header. So if your locale is ASCII, CP1252 or anything different of UTF-8, read the file will fails.
I wrote a patch to detect the encoding. Python code (detect_encoding() function) is based on PyTokenizer_FindEncoding() and get_coding_spec() (from Parser/tokenizer.c). There is no existing Python function to detect the encoding of a Python script? (a public function available in a Python script) ---------- keywords: +patch Added file: http://bugs.python.org/file11673/idle_encoding.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4008> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com