This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients loewis, vstinner
Date 2008-10-03.22:37:11
SpamBayes Score 2.990208e-11
Marked as misclassified No
Message-id <1223073433.74.0.13349664868.issue4008@psf.upfronthosting.co.za>
In-reply-to
Content
@loewis: I guess that your locale is still UTF-8.

On Linux (Ubuntu Gutsy) using "env -i DISPLAY=$DISPLAY HOME=$HOME 
xterm" to get a new empty environment, I get:

$ locale
LANG=
LC_ALL=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
...
$ python3.0
>>> from idlelib.IOBinding import encoding
>>> encoding 
'ansi_x3.4-1968'
>>> import locale
>>> locale.getdefaultlocale()
(None, None)
>>> locale.nl_langinfo(locale.CODESET)
'ANSI_X3.4-1968'

In this environment, IDLE is unable to detect 
idle-3.0rc1-quits-when-run.py encoding.

IDLE uses open(filename, 'r'): it doesn't specify the charset. In this 
case, TextIOWrapper uses locale.getpreferredencoding() as encoding (or 
ASCII on failure).

To sum IDLE: if your locale is UTF-8, you will be able to open an 
UTF-8 file. So for example, if your locale is UTF-8, you won't be able 
to open an ISO-8859-1 file. Let's try iso.py: IDLE displays the 
error "Failed to decode" and quit whereas I specified the encoding :-/
History
Date User Action Args
2008-10-03 22:37:13vstinnersetrecipients: + vstinner, loewis
2008-10-03 22:37:13vstinnersetmessageid: <1223073433.74.0.13349664868.issue4008@psf.upfronthosting.co.za>
2008-10-03 22:37:12vstinnerlinkissue4008 messages
2008-10-03 22:37:11vstinnercreate