[PR #14417] Rewrite Utf16Parser #30093

Closed
opened 2026-01-31 09:38:36 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14417

State: closed
Merged: Yes


This commit replaces Utf16Parser with <til/unicode.h> which includes:

  • til::utf16_iterator as a replacement for Utf16Parser::Parse
  • til::utf16_next as a replacement for Utf16Parser::ParseNext

This fixes 2 bugs with Utf16Parser:

  • Swallowing invalid surrogate pairs instead of turning them into U+FFFD.
  • std::vector<std::vector<wchar_t>>. It's now >12000% faster.

Validation Steps Performed

  • New unit tests pass
  • Searching for narrow/wide characters in conhost works
**Original Pull Request:** https://github.com/microsoft/terminal/pull/14417 **State:** closed **Merged:** Yes --- This commit replaces `Utf16Parser` with `<til/unicode.h>` which includes: * `til::utf16_iterator` as a replacement for `Utf16Parser::Parse` * `til::utf16_next` as a replacement for `Utf16Parser::ParseNext` This fixes 2 bugs with `Utf16Parser`: * Swallowing invalid surrogate pairs instead of turning them into U+FFFD. * `std::vector<std::vector<wchar_t>>`. It's now >12000% faster. ## Validation Steps Performed * New unit tests pass ✅ * Searching for narrow/wide characters in conhost works ✅
claunia added the pull-request label 2026-01-31 09:38:36 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30093