Skip to content

Fix problem with SetConsoleOutputCP CP_UTF8 on Windows#896

Open
madah81pnz1 wants to merge 2 commits intoxiph:masterfrom
madah81pnz1:fix-win-unicode
Open

Fix problem with SetConsoleOutputCP CP_UTF8 on Windows#896
madah81pnz1 wants to merge 2 commits intoxiph:masterfrom
madah81pnz1:fix-win-unicode

Conversation

@madah81pnz1
Copy link
Copy Markdown
Contributor

No description provided.

Also splits up the WriteConsoleW() calls if the buffer is too big,
as this was at least a problem in Windows 7 and earlier.
@madah81pnz1
Copy link
Copy Markdown
Contributor Author

Note this needs more testing, especially piping binary from stdin.
Also this removes the \r\n and \n translation, which might mean some adaptions are needed in case a user is piping a file that does contains \r\n, since then the \r will appear in the input.

Also might need another test binary to be able to test windows console output properly, e.g. by calling ReadConsoleW() to check what was actually written.

@madah81pnz1
Copy link
Copy Markdown
Contributor Author

Note this needs more testing, especially piping binary from stdin.

Reading from stdin turns into mojibake, e.g. --import-tags-from-file=-
I guess it has to use the same method as output, ReadConsoleW/ReadFile, Using fopen with stdin will not work, as the (wide) input will then be translated to the current codepage.

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.

1 participant