Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59855 > unrolled thread
| Started by | Robin Becker <robin@reportlab.com> |
|---|---|
| First post | 2013-11-18 11:47 +0000 |
| Last post | 2013-11-18 11:47 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Unicode stdin/stdout Robin Becker <robin@reportlab.com> - 2013-11-18 11:47 +0000
| From | Robin Becker <robin@reportlab.com> |
|---|---|
| Date | 2013-11-18 11:47 +0000 |
| Subject | Re: Unicode stdin/stdout |
| Message-ID | <mailman.2837.1384775291.18130.python-list@python.org> |
On 15/11/2013 18:16, random832@fastmail.us wrote:
> Of course, the real solution to this issue is to replace sys.stdout on
> windows with an object that can handle Unicode directly with the
> WriteConsoleW function - the problem there is that it will break code
> that expects to be able to use sys.stdout.buffer for binary I/O. I also
> wasn't able to get the analogous stdin replacement class to work with
> input() in my attempts.
>
I started to use this on my windows installation
#c:\python33\lib\site-packages\sitecustomize.py
import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
which makes them writable with any unicode; after many years I am quite used to
garbage appearing in the windows console.
Unfortunately the above doesn't go into virtual environments, but I assume a
hacked site.py could do that.
--
Robin Becker
Back to top | Article view | comp.lang.python
csiph-web