[I18n-sig] "takeuchi": a unicode string on IDLE shell

Andy Robinson andy@reportlab.com
Mon, 10 Apr 2000 20:46:25 +0100


----- Original Message -----
From: Guido van Rossum <guido@python.org>
To: <python-dev@python.org>
Cc: <i18n-sig@python.org>
Sent: 10 April 2000 15:01
Subject: [I18n-sig] "takeuchi": a unicode string on IDLE shell


> Can anyone answer this?  I can reproduce the output side of this, and
> I believe he's right about the input side.  Where should Python
> migrate with respect to Unicode input?  I think that what Takeuchi is
> getting is actually better than in Pythonwin or command line (where he
> gets Shift-JIS)...
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
I think what he wants, as you hinted, is to be able to specify a 'system
wide' default encoding of Shift-JIS rather than UTF8.

UTF-8 has a certain purity in that it equally annoys every nation, and is
nobody's default encoding.  What a non-ASCII user needs is a site-wide way
of setting the default encoding used for standard input and output.  I think
this could be done with something (config file?  registry key) which site.py
looks at, and wraps stream encoders around stdin, stdout and stderr.

To illustrate why it matters, I often used to parse data files and do
queries on a Japanese name and address database; I could print my lists and
tuples in interactive mode and check they worked, or initialise functions
with correct data, since the OS uses Shift-JIS as its native encoding and I
was manipulating Shift-JIS strings.  I've lost that ability now due to the
Unicode stuff and would need to do
   >>> for thing in mylist:
   >>> ....print mylist.encode('shift_jis')
to see the contents of a database row, rather than just
   >>> mylist

BTW, Pythonwin stopped working in this regard when Scintilla came along; it
prints a byte at a time now, although kanji input is fine, as is kanji
pasted into a source file, as long as you specify a Japanese font.  However,
this is fixable - I just need to find a spare box to run Japanese windows on
and find out where the printing goes wrong.

Andy Robinson
ReportLab