[Python-Dev] PEP 528: Change Windows console encoding to UTF-8

Paul Moore p.f.moore at gmail.com
Mon Sep 5 16:08:46 EDT 2016


On 5 September 2016 at 20:30, Steve Dower <steve.dower at python.org> wrote:
> The only case we can reasonably handle at the raw layer is "n / 4" is zero
> but n != 0, in which case we can read and cache up to 4 bytes (one wchar_t)
> and then return those in future calls. If we try to cache any more than that
> we're substituting for buffered reader, which I don't want to do.
>
> Does caching up to one (Unicode) character at a time sound reasonable? I
> think that won't be much trouble, since there's no interference between
> system calls in that case and it will be consistent with POSIX behaviour.

Caching a single character sounds perfectly OK. As I noted previously,
my use case probably won't need to work at the raw level anyway, so I
no longer expect to have code that will break, but I think that a
1-character buffer ensuring that we avoid surprises for code that was
written for POSIX is a good trade-off.

Paul


More information about the Python-Dev mailing list