Giovanni Bajo has posted comments on this change.
os: use GetConsoleCP() instead of GetACP()
Patch Set 10: Code-Review+1
(2 comments)
https://go-review.googlesource.com/#/c/27575/9//COMMIT_MSG
Commit Message:
Line 23: Change-Id: I4f41ae83ece47321b6e9a79a2087ecbb8ac066dd
I think this commit message is too large and doesn't address the correct
points. Consider that this whole issue of MB_PRECOMPOSED is a little moot;
we are using the default, which is the Unicode NFC form, which is the same
defaults for almost all Unicode-handling library and systems in the world
(with a very few exceptions), so it's not something that should be
highlighted in a commit message. I suggest this phrasing:
os: use GetConsoleCP() instead of GetACP()
It is possible (and common) for Windows systems to use a different codepage
for console applications from that used on normal windowed application
(called ANSI codepage); for instance, most of the western Europe uses CP850
for console (for backward compatibility with MS-DOS), while windowed
applications use a different codepage depending on the country (eg: CP1252
aka Latin-1). The usage being changed with this commit is specifically
related to decoding input coming from the console, so the previous usage of
the ANSI codepage was wrong.
Fixes #16857.
https://go-review.googlesource.com/#/c/27575/9/src/os/file_windows.go
File src/os/file_windows.go:
PS9, Line 226: // Specify MB_PRECOMPOSED for the dwFlags
This comment is confusing because it says that we specify a flag while the
the code doesn't use it.
If you want to leave a trace of the issue that was discussed here, I would
write something like:
// Convert from 8-bit console encoding to UTF16.
// MultiByteToWideChar defaults to Unicode NFC form, which is the expected
one.