{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/16857","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/16857/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/16857/comments","events_url":"https://api.github.com/repos/golang/go/issues/16857/events","html_url":"https://github.com/golang/go/issues/16857","id":172841942,"number":16857,"title":"internal/syscall/windows GetACP returns wrong codepage","user":{"login":"tkausl","id":726254,"avatar_url":"https://avatars.githubusercontent.com/u/726254?v=3","gravatar_id":"","url":"https://api.github.com/users/tkausl","html_url":"https://github.com/tkausl","followers_url":"https://api.github.com/users/tkausl/followers","following_url":"https://api.github.com/users/tkausl/following{/other_user}","gists_url":"https://api.github.com/users/tkausl/gists{/gist_id}","starred_url":"https://api.github.com/users/tkausl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkausl/subscriptions","organizations_url":"https://api.github.com/users/tkausl/orgs","repos_url":"https://api.github.com/users/tkausl/repos","events_url":"https://api.github.com/users/tkausl/events{/privacy}","received_events_url":"https://api.github.com/users/tkausl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-08-24T01:00:13Z","updated_at":"2016-08-24T03:40:13Z","closed_at":null,"body":"1. What version of Go are you using (`go version`)?\r\n1.7\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\nWindows, arm64\r\n`go env`:\r\n\r\n  ```\r\n  set GOARCH=amd64\r\n  set GOBIN=\r\n  set GOEXE=.exe\r\n  set GOHOSTARCH=amd64\r\n  set GOHOSTOS=windows\r\n  set GOOS=windows\r\n  set GOPATH=C:\\dev\\golang\r\n  set GORACE=\r\n  set GOROOT=C:\\Go\r\n  set GOTOOLDIR=C:\\Go\\pkg\\tool\\windows_amd64\r\n  set CC=gcc\r\n  set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\\Users\\Tobias\\AppData\\Local\\Temp\\go-build473402786=/tmp/go-build -gno-record-gcc-switches\r\n  set CXX=g++\r\n  set CGO_ENABLED=1\r\n    ```\r\n\r\n3. What did you do?\r\nI wrote a program which just reads bytes from `os.Stdin` and prints their values as Hex to Stdout. I started the program, typed a `ä` to the console and pressed enter.\r\n\r\n4. What did you expect to see?\r\nI expected to see the correct UTF-8 sequence for a `ä` which is `C3 A4`\r\n\r\n5. What did you see instead?\r\nI see the Hex-sequence `E2 80 9E`\r\n\r\n\r\nI found that internal/syscall/windows GetACP() returns 1252 even though I can verify that the `ä` is encoded in CP850. Because of this wrongly returned codepage, Stdin.readConsole tries to decode the character from 1252 to UTF-8 instead of from 850 to UTF-8. As you see in my Post on [Stackoverflow](http://stackoverflow.com/questions/39111624/golang-stdin-reads-german-umlauts-wrong), when I read from stdin through CGO I get the byte 0x84 which is the value for a `ä` in CP850, it should've been 0xE4 if it were in 1252. The value 0x84 decoded from `golang.org/x/text/encoding/charmap`.`CodePage850` decodes to the correct UTF-8 character.\r\n\r\n`chcp` tells me that the active codepage is 850."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/241949105","html_url":"https://github.com/golang/go/issues/16857#issuecomment-241949105","issue_url":"https://api.github.com/repos/golang/go/issues/16857","id":241949105,"user":{"login":"mattn","id":10111,"avatar_url":"https://avatars.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T03:40:13Z","updated_at":"2016-08-24T03:40:13Z","body":"@tkausl thanks your confirming. MB_PRECOMPOSED will fix the issue. I'm working on vim-dev and vim implement vim.exe using MB_PRECOMPOSED not MB_COMPOSITE. I don't hear any issue about using MB_PRECOMPOSED. Thanks."}}
{"actor":{"display_login":"mattn"}}