You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong encoding in files saved from IDLE (3.0rc2 on Windows) #48573
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2008-12-29.18:47:20.646>created_at=<Date2008-11-14.11:03:13.728>labels= ['type-bug']
title='Wrong encoding in files saved from IDLE (3.0rc2 on Windows)'updated_at=<Date2008-12-29.18:47:20.644>user='https://bugs.python.org/andre'
Implementation of the second solution: replace Ok button by a Cancel
button. Escape key is Cancel, whereas Return key is the default
action: edit the file.
loewis commented on Nov 14, 2008
loewismannequin
Mannequin
More actions
The entire dialog should go away. The default source encoding is UTF-8
in Python 3.0, and IDLE should know that. The locale's encoding
shouldn't ever be considered.
loewis commented on Nov 19, 2008
loewismannequin
Mannequin
More actions
Here is a patch that removes the entire IDLE coding option machinery,
thus implementing PEP-3120.
The patch is good and does simplify things: the py3k conversion to
unicode may have some advantages sometimes!
I suggest to also remove the remaining two occurrences of
"frameEncoding" in configDialog.py. This will suppress the extra space
between the last two blocks of the dialog.
loewis commented on Dec 29, 2008
loewismannequin
Mannequin
More actions
Thanks for the review. Committed (with the proposed change) as r68022
and r68023.
Activity
andre commentedon Nov 14, 2008
When saving a source file with non-ascii characters from an IDLE window,
on Windows platform (XP and Server 2003 at least)
with locale English US
IDLE prompts in IOBinding.py with the message
"non Ascii found, yet no encoding declared, Add a line like # --
coding: cp1252 --"
If accepted, the file is saved with the wrong encoding.
Afterwards, it is read back by IDLE without any problem and it looks
good in the IDLE window.
However, if a string with non-ascii characters is sent to another
module (i.e. email MIMEText)
the string is wrong.
The same source would be rejected by python in terminal mode and by
IDLE on Linux.
vstinner commentedon Nov 14, 2008
"accept" means click on the "OK" button. You have to click on the
biggest button "Edit my file" to create a valid file.
The problem here is the text in the dialog but also the possibility to
create an invalid file.
Two solutions:
ASCII only file but inserted by error an unicode character (eg. non
breaking space!)
vstinner commentedon Nov 14, 2008
Quick but ugly solution: force the #coding: header without asking the
user for that.
vstinner commentedon Nov 14, 2008
Implementation of the second solution: replace Ok button by a Cancel
button. Escape key is Cancel, whereas Return key is the default
action: edit the file.
loewis commentedon Nov 14, 2008
The entire dialog should go away. The default source encoding is UTF-8
in Python 3.0, and IDLE should know that. The locale's encoding
shouldn't ever be considered.
loewis commentedon Nov 19, 2008
Here is a patch that removes the entire IDLE coding option machinery,
thus implementing PEP-3120.
amauryfa commentedon Nov 21, 2008
The patch is good and does simplify things: the py3k conversion to
unicode may have some advantages sometimes!
I suggest to also remove the remaining two occurrences of
"frameEncoding" in configDialog.py. This will suppress the extra space
between the last two blocks of the dialog.
loewis commentedon Dec 29, 2008
Thanks for the review. Committed (with the proposed change) as r68022
and r68023.