Re: A python IDE for teaching that supports cyrillic i/o



On Sun, Nov 19, 2006 at 02:54:33PM -0800, Leo Kislov wrote:
Kirill Simonov wrote:
On Sun, Nov 19, 2006 at 03:27:32AM -0800, Leo Kislov wrote:
IDLE on Windows works fine for your example in interactive console:

name = raw_input("What's your name? ")

Have you tried to use cyrillic characters in a Python string in
interactive console? When I do it, I get the "Unsupported characters in
input" error. For instance,

print "Привет" # That's "Hi" in Russian.
Unsupported characters in input

That works for me in Win XP English, with Russian locale and Russian
language for non-unicode programs. Didn't you say you want to avoid
unicode? If so, you need to set proper locale and language for
non-unicode programs.

Thanks. After I set Russian language for non-unicode programs, the
`print "Привет"` expression started to work correctly.

On the other hand,
>>> print u"Привет"
doesn't display "Привет". The output looks like a CP1251-encoded string
was displayed using the latin1 character set.

It seems that the interactive interpreter in IDLE uses the CP1251
codepage.

Anyway, I just want the interactive console of an IDE to behave like a
real Python console under a UTF-8 terminal (with sys.stdout.encoding ==
'utf-8').

Do you realize that utf-8 locale makes len() function and slicing of
byte strings look strange for high school students?

hi = u"Привет".encode("utf-8")
r = u"р".encode("utf-8")
print len(hi) # prints 12
print hi[1] == r # prints False
for char in hi:
print char # prints garbage

No, it slipped off my mind...

As I see you have several options:
1. Set Russian locale and Russian language for non-unicode programs on
Windows.

I guess I will go this route. Looks that IDLE works reasonable well in
CP1251 locale.


Thanks,
Kirill
.



Relevant Pages

  • Re: cant run CDs in Russian
    ... I have added Russian to "Text Services ... whether he gets the correct characters when web browsing to sites that use ... I think it is a locale problem. ... default locale and Russian is the default language. ...
    (microsoft.public.windowsxp.general)
  • Re: Reg multilanguage support by gnuplot
    ... The "locale" setting is need in order to interpret 1-byte character ... It is not needed if you are using UTF-8. ... type the characters directly into your command string. ... set label 1 at screen 0.2, ...
    (comp.graphics.apps.gnuplot)
  • Re: MIDP MIDlet: which characters are supported in the phone font?
    ... by the locale where the phone is meant to be used. ... "Which unicode characters does a phone support? ... >> the font set on the phone. ... > I rather doubt any of them do not also display latin letters. ...
    (comp.lang.java.programmer)
  • Re: MIDP MIDlet: which characters are supported in the phone font?
    ... you're going on about the Locale class and saying that my using ... That's why I didn't say *anything* about the font, ... > set of characters displayable by any or all phones meant for that ... Because Korean phones also display non-Korean, ...
    (comp.lang.java.programmer)
  • Re: RegExp to find hex value 0D fails
    ... that the Asc and AscW values for some characters are different: ... artefact of the ASCW function. ... Locale'US English ... the US English locale is different from the AscW value for Czech. ...
    (microsoft.public.scripting.vbscript)

Loading