Skip to content

fix(std): correct low surrogate range in Windows console write#383

Open
SebTardif wants to merge 2 commits into
mainfrom
fix-f192
Open

fix(std): correct low surrogate range in Windows console write#383
SebTardif wants to merge 2 commits into
mainfrom
fix-f192

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Fixes #377

The low surrogate detection range 0xDCEE..=0xDFFF is incorrect and should be 0xDC00..=0xDFFF. This misses surrogates 0xDC00 through 0xDCED, causing incorrect UTF-8 byte count calculation for supplementary Unicode characters written to the Windows console.

The low surrogate detection range 0xDCEE..=0xDFFF is incorrect and
should be 0xDC00..=0xDFFF. The current range misses surrogates
0xDC00 through 0xDCED, causing incorrect UTF-8 byte count
calculation for supplementary Unicode characters (emoji, CJK
Extension B, etc.) written to the Windows console. This results in
the Write trait reporting fewer bytes written than actually consumed,
potentially causing callers to re-send data or corrupt output.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Verifies the full low surrogate range U+DC00..=U+DFFF is recognized
for correct UTF-16 to UTF-8 byte counting in Windows console output.
Code units 0xDC00..0xDCED were previously misclassified.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif SebTardif added bug Something isn't working I-wrong Wrong result or data corruption P-medium Medium impact: affects specific usage patterns A-libs Standard library O-windows Windows-specific labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-libs Standard library bug Something isn't working I-wrong Wrong result or data corruption O-windows Windows-specific P-medium Medium impact: affects specific usage patterns

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows console write uses wrong low surrogate range (0xDCEE instead of 0xDC00)

1 participant