Skip to content

Conversation

kblees
Copy link

@kblees kblees commented May 9, 2015

Separated from PR #141

Using different code pages for console input (SetConsoleCP()) and console
output (SetConsoleOutputCP()) doesn't make much sense and may be hazardous
for native Windows programs.

Git uses UTF-8 internally, so it actually needs 'SetConsoleCP(CP_UTF8)'
rather than 'SetConsoleCP(GetACP())'. However, ReadFile() / ReadConsoleA()
are broken with CP_UTF8 (and thus any higher level APIs such as fgetc(),
getchar() etc.). Unicode-aware console input would have to be implemented
via mingw_* wrappers using ReadConsoleW(). As Git typically launches an
editor for anything more complex than ASCII-only, yes/no-style questions,
this is currently not a problem.

Drop 'SetConsoleCP()' from the git-wrapper, so that input and output code
pages stay in sync.

Signed-off-by: Karsten Blees <blees@dcon.de>
dscho added a commit that referenced this pull request May 9, 2015
git-wrapper: don't set the console input code page
@dscho dscho merged commit 975e780 into git-for-windows:master May 9, 2015
@dscho
Copy link
Member

dscho commented May 9, 2015

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants