[Patches] [ python-Patches-520483 ] Make IDLE OutputWindow handle Unicode

noreply@sourceforge.net noreply@sourceforge.net
Sat, 23 Feb 2002 16:19:11 -0800


Patches item #520483, was opened at 2002-02-20 06:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=520483&group_id=5470

Category: None
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Jason Orendorff (jorend)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make IDLE OutputWindow handle Unicode

Initial Comment:
This one-line patch makes OutputWindow handle
Unicode correctly.  For example,

  >>> print u'\xbfQu\xe9 pas\xf3?'

In 2.2 this throws a UnicodeError,
not because of any problem with Unicode
handling in either Python or Tk, but
because IDLE does str(s) on the Unicode
string.

I just took out the call to str().


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

>Comment By: Jason Orendorff (jorend)
Date: 2002-02-23 16:19

Message:
Logged In: YES 
user_id=18139

Submitted to idlefork.

I'm too shy to bother "one of the major IDLE authors."  It 
would be nice to have in 2.2.1, but I know the folks at 
PythonLabs are busy...

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-02-23 14:42

Message:
Logged In: YES 
user_id=21627

Ok, committed as OutputWindow 1.6. I strongly recommend to
submit this to idlefork as well. If want this patch to
appear in Python 2.2.1, you should get a comment from one of
the major IDLE authors or contributors.

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

Comment By: Jason Orendorff (jorend)
Date: 2002-02-20 15:27

Message:
Logged In: YES 
user_id=18139

> Isn't this too simplistic? I guess there was a reason for
> the str call: could it ever happen that somebody passes
> something else (beyond byte and Unicode strings)?

I searched for write() in the idle directory and got
48 hits in 7 files.  Then I checked them all.  In every
case, either write() is called with a string, or the
argument is passed unchanged from another function that
contains the word "write()".

As for code outside IDLE, I'd be extra surprised if
anyone calls obj.write(x) with x being something other
than a string.  Ordinary file objects don't accept it.


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

Comment By: Martin v. Löwis (loewis)
Date: 2002-02-20 14:56

Message:
Logged In: YES 
user_id=21627

Isn't this too simplistic? I guess there was a reason for
the str call: could it ever happen that somebody passes
something else (beyond byte and Unicode strings)?

Also, I wonder whether IDLE patches need to go to idlefork
(sf.net/projects/idlefork) first.

Apart from this comments, I think your patch is quite right.

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

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