Windows vs UTF-8 (issue 15845)
ag0aep6g via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 3 17:06:28 PDT 2016
On Sunday, 3 April 2016 at 23:29:18 UTC, Martin Krejcirik wrote:
> I think ReadConsole and WriteConsole API functions work with
> codepage 65001. (Sorry my previous reply went to your email).
Yeah, ReadConsole does work, somewhat. The data comes in as
UTF-16, not UTF-8, though. And this time it only works when when
stdin is a TTY (opposite of ReadFile).
So our reading functions would have to query _isatty and choose
ReadFile or ReadConsole depending on the result. When using
ReadConsole, they would also have to convert from UTF-16 to
UTF-8. At that point it would probably make sense to detect other
code pages as well and convert from those to UTF-8.
Weird how bad the support for UTF-8 seems to be in Windows.
More information about the Digitalmars-d
mailing list