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.