Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59860
| References | <5286054F.6000707@chamonix.reportlab.co.uk> <1384539385.17784.47988289.02AE655C@webmail.messagingengine.com> <5289FE6C.7030007@chamonix.reportlab.co.uk> <528A092D.4060408@chamonix.reportlab.co.uk> |
|---|---|
| Date | 2013-11-18 22:59 +1000 |
| Subject | Re: [Python-ideas] Unicode stdin/stdout |
| From | Nick Coghlan <ncoghlan@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2841.1384779566.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On 18 Nov 2013 22:36, "Robin Becker" <robin@reportlab.com> wrote:
>
> On 18/11/2013 11:47, Robin Becker wrote:
> ...........
>>
>> #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())
>
> ........
> it seems that the above needs extra stuff to make some distutils logging
work etc etc; so now I'm using sitecustomize.py containing
>
> import sys, codecs
> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
> sys.stdout.encoding = 'utf8'
> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
> sys.stderr.encoding = 'utf8'
Note that calling detach() on the standard streams isn't officially
supported, since it breaks the shadow streams saved in sys.__stderr__, etc.
Cheers,
Nick.
>
> --
> Robin Becker
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Python-ideas] Unicode stdin/stdout Nick Coghlan <ncoghlan@gmail.com> - 2013-11-18 22:59 +1000
csiph-web