A python IDE for teaching that supports cyrillic i/o

PyScripter pyscripter at gmail.com
Mon Nov 20 08:50:50 EST 2006


Kirill Simonov wrote:
> On Sat, Nov 18, 2006 at 06:11:48PM -0800, PyScripter wrote:
> > Kirill Simonov wrote:

> In PyScripter,
>     >>> print "...some cyrillic characters..."
> produces output as if an UTF-8 string is displayed in latin1.
> On the other hand,
>     >>> print u"...some cyrillic characters..."
> works correctly in PyScripter.  Both above examples works correctly in a
> real console when sys.stdout.encoding is set to 'utf-8'.

This is a problem with Python's compile function, which does not take
an encoding parameter  (same issue with IDLE).  This issue has been
discussed earlier in the Python newsgroups.  However PyScripter offers
an IDE option (Tools, Options, IDE options) "Use utf-8 in the
interpreter".  If this option is checked print u"...some cyrillic
characters..." works, otherwise print "...some cyrillic characters..."
works assuming you have the correct sys.getdefaultencoding().  So you
have a choice!

Unfortunately you cannot make both versions to work in the interactive
interpreter at the same time.  The "real" console takes the input from
streams the encoding of which can be specified.  Although this is
possible in PyScripter, it is a bit of a hassle to implement, but I may
do it in a future version.  Please note that when you run scripts both
versions will work with the right source encoding comment.


> raw_input() doesn't work at all with non-ASCII characters in PyScripter.
>     >>> raw_input("...some cyrillic characters...")
> displays the label in latin1 while
>     >>> raw_input(u"...some cyrillic characters...")
> produces UnicodeDecodeError.
>

raw_input is fixed and now accepts unicode in version 1.7.2.5.
Download from http://pyscripter.googlepages.com/PyScripterv1.7.2.5.zip.




More information about the Python-list mailing list