[Idle-dev] [ idlefork-Patches-508973 ] Support national characters

noreply@sourceforge.net noreply@sourceforge.net
Mon, 20 May 2002 18:02:58 -0700


Patches item #508973, was opened at 2002-01-27 08:36
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=508973&group_id=9579

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin v. Löwis (loewis)
Assigned to: Nobody/Anonymous (nobody)
Summary: Support national characters

Initial Comment:
With the attached patch, IDLE will allow to edit text
with national characters, and properly save the file.

To achieve this, several mechanisms are used:
1. If the file has an emacs-style coding declartion
   (e.g. -*- coding: koi8-r -*-), this encoding will
   be used to load and store the file.

2. Otherwise, the locale's encoding will be used.
   This is determined as "mbcs" on Windows, and
nl_langinfo(CODESET) on Unix (requires Python 2.2). If
determination fails, "ascii" is used.

3. The text is encoded/decoded to the encoding
determined above. If that fails, saving falls back to
UTF-8, and loading falls back to passing a byte string
to Tcl.

4. In PyShell interactive mode, IOBinding.encoding is
used to encode Unicode strings before compiling them.

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

>Comment By: Stephen M. Gava (elguavas)
Date: 2002-05-21 11:02

Message:
Logged In: YES 
user_id=75867

Sure. Let me put it another way: The original message
mentions IDLE itself and I agree with that hint that this
seems to be an important issue that should perhaps be
adressed in python idle itself and tracked in idlefork. So,
is the reason for submitting this to idlefork rather that
idle that these changes may have unforseen results, and
therefore would be better to be tested in idlefork first?
Martin?

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-05-21 10:26

Message:
Logged In: YES 
user_id=6380

I think MvL knows what to do with patches for Python IDLE.
:-)

I recommend applying this patch unless it doesn't work.

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

Comment By: Stephen M. Gava (elguavas)
Date: 2002-05-20 13:11

Message:
Logged In: YES 
user_id=75867

Are you intending this patch for python idle? If so you need
to submit it to the python patch manager.

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-01-27 08:37

Message:
Logged In: YES 
user_id=21627

If you want to verify that the patch functions correctly,
please open the attached mvl.py, which should have two
strings; a latin one (with a single umlaut) and a cyrillic one.

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=508973&group_id=9579