[Patches] [ python-Patches-1333679 ] Allow use of non-latin1 chars in interactive shell

SourceForge.net noreply at sourceforge.net
Fri Oct 21 02:49:50 CEST 2005


Patches item #1333679, was opened at 2005-10-21 02:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1333679&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: IDLE
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Noam Raphael (noamr)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow use of non-latin1 chars in interactive shell

Initial Comment:
If I type a unicode string, such as u"שלום" in the
interactive interpreter in the terminal, it does what I
expect - return the unicode string (in this case,
u'\u05e9\u05dc\u05d5\u05dd')

However, if I type it in IDLE's interactive
interpreter, I get something funny - I get a unicode
string (u'\xd7\xa9\xd7\x9c\xd7\x95\xd7\x9d'), which is
actually u"שלום".decode('utf8').encode('latin1').

This is caused by the PyShell.runsource method, which
checks if the source string it gets is unicode, and if
so, encodes it using the 'ascii' codec. If this check
is removed, so that the unicode object itself gets
compiled, everything works out fine.

The bottom line: remove the if block starting with "if
isinstance(source, types.UnicodeType)", at
PyShell.py:589, and everything is fine.

Have a good day,
Noam

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

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


More information about the Patches mailing list