[Idle-dev] [ idlefork-Patches-682347 ] Another locale encoding patch

SourceForge.net noreply@sourceforge.net
Fri, 07 Feb 2003 07:35:04 -0800


Patches item #682347, was opened at 2003-02-07 14:47
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309579&aid=682347&group_id=9579

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Kirill Simonov (kirill_simonov)
Assigned to: Nobody/Anonymous (nobody)
Summary: Another locale encoding patch

Initial Comment:
This patch is for use with the patch #615312.

With this patch, stdin.readline() returns an ordinary
string in the locale's encoding, not an Unicode string.

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

>Comment By: Kirill Simonov (kirill_simonov)
Date: 2003-02-07 15:35

Message:
Logged In: YES 
user_id=36553

Two reasons.

1. The following script does not work correctly in IDLE:

# -*- encoding: koi8-r -*-
name = raw_input("What's your name?")
print "Hi %s!" % name

I use russian phrases here, of course.

And if I enter my name using cyrillic letters,
I get UnicodeError. This is because I mixed
a Unicode string with with an 8-bit string.

I know that I can use unicode literals,
but I don't think that my students should know
anything about Unicode, 6 cyrrilic encodings,
etc, especially when they are writing their first
program.

Note that this program is absolutely correct and
run perfectly from console. So I think that it
should work in IDLE too.

2. I believe that raw_input() and stdin.readline()
must always return either Unicode strings or
8-bit strings, but do not mix them.

P.S. I think that -*- encoding -*- comments are
very unfriendly for newbies too, but that's another
story.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-02-07 14:55

Message:
Logged In: YES 
user_id=6380

Why would you want that?

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

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