[Idle-dev] [ idlefork-Patches-682347 ] Another locale encoding patch
SourceForge.net
noreply@sourceforge.net
Mon, 24 Mar 2003 01:02:35 -0800
Patches item #682347, was opened at 2003-02-07 15: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: Martin v. Löwis (loewis)
Date: 2003-03-24 10:02
Message:
Logged In: YES
user_id=21627
Reason #2 is obsolete now; raw_input *can* result in Unicode
strings in Python 2.3.
I can sympathise with the patch. However, I would like to see
it combined with a patch to let applications determine the
encoding used, e.g. by querying sys.stdin.encoding.
Otherwise, getting raw bytes will complicate matters. See
also Python patch #612627, which adds the encoding
attribute to a terminal stdout.
----------------------------------------------------------------------
Comment By: Kirill Simonov (kirill_simonov)
Date: 2003-02-18 00:25
Message:
Logged In: YES
user_id=36553
There are no such a problem with Idlefork.
The author of the post was using the original IDLE from the
2.2 distribution.
Note the line in the traceback:
File "[...]\Tools\idle\ColorDelegator.py", line 196, in
recolorize_main
if value in ("def", "class"):
The line 196 of ColorDelegator.py from Idlefork 0.9a2 is
different.
----------------------------------------------------------------------
Comment By: Kurt B. Kaiser (kbk)
Date: 2003-02-17 23:14
Message:
Logged In: YES
user_id=149084
Does this solve the problem mentioned in
http://mail.python.org/pipermail/idle-dev/2003-February/001628.html
----------------------------------------------------------------------
Comment By: Kirill Simonov (kirill_simonov)
Date: 2003-02-07 16: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 15: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