[Python-bugs-list] [ python-Bugs-545600 ] IDLE doesn't save 8bit files

noreply@sourceforge.net noreply@sourceforge.net
Fri, 19 Apr 2002 01:23:29 -0700


Bugs item #545600, was opened at 2002-04-18 13:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=545600&group_id=5470

Category: IDLE
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexandre Fayolle (afayolle)
Assigned to: Nobody/Anonymous (nobody)
Summary: IDLE doesn't save 8bit files

Initial Comment:
This bug seems to be related to #527022. 

Short version is: IDLE won't save files containing 8bit
characters (for instance in comments or in litteral
strings). No error dialog is displayed, only a
traceback on stderr or in the interactive window if
it's available:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.1/lib-tk/Tkinter.py", line
1285, in __call__
    return apply(self.func, args)
  File "/usr/lib/idle-python2.1/IOBinding.py", line
126, in save
    self.save_as(event)
  File "/usr/lib/idle-python2.1/IOBinding.py", line
136, in save_as
    if self.writefile(filename):
  File "/usr/lib/idle-python2.1/IOBinding.py", line
154, in writefile
    f.write(chars)
UnicodeError: ASCII encoding error: ordinal not in
range(128)

Possible solution:

 * at least warn the user that the file could not be
saved with an error dialog
 * try using the locale to guess the encoding and do
appropriate conversions
 * ask the user wich encoding should be used to save
the file

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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-04-19 10:23

Message:
Logged In: YES 
user_id=21627

In this form, this is not a bug. IDLE cannot know what
encoding you want to use the file.

Under PEP 263, you will need to declare the encoding inside
the file; then IDLE will use the declared encoding. See

http://sourceforge.net/tracker/index.php?func=detail&aid=508973&group_id=9579&atid=309579

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

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