-
Notifications
You must be signed in to change notification settings - Fork 9.2k
WriteConsoleOutputCharacterA doesn't merge UTF-8 partials in successive calls #1851
Copy link
Copy link
Open
Labels
Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)Related to output processing (inserting text into buffer, retrieving buffer text, etc.)Area-ServerDown in the muck of API call servicing, interprocess communication, eventing, etc.Down in the muck of API call servicing, interprocess communication, eventing, etc.Issue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Product-ConhostFor issues in the Console codebaseFor issues in the Console codebase
Milestone
Metadata
Metadata
Assignees
Labels
Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)Related to output processing (inserting text into buffer, retrieving buffer text, etc.)Area-ServerDown in the muck of API call servicing, interprocess communication, eventing, etc.Down in the muck of API call servicing, interprocess communication, eventing, etc.Issue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Product-ConhostFor issues in the Console codebaseFor issues in the Console codebase
Environment
Steps to reproduce
If a UTF-8 stream gets buffered in a loop, characters that consume more than one byte may get split at the buffer boundaries. Passing the buffer to
WriteConsoleOutputCharacterAwill corrupt the text because a conversion to UTF-16 is in place where these partials are treated as invalid UTF-8 characters and replaced with with U+FFFD characters.Expected behavior
WriteConsoleOutputCharacterAshould cache the partials and prepend them to the characters passed at the next call of this function, similar to the behavior ofWriteConsoleA.Actual behavior
UTF-8 partials result in corrupted text.
A discussion about this already began in #386 but was rather out of scope in this issue.