Skip to content

Add UTF-16 (BE and LE) string compare#764

Merged
sindresorhus merged 4 commits intomainfrom
utf16-string-compare
Jun 10, 2025
Merged

Add UTF-16 (BE and LE) string compare#764
sindresorhus merged 4 commits intomainfrom
utf16-string-compare

Conversation

@Borewit
Copy link
Copy Markdown
Collaborator

@Borewit Borewit commented Jun 9, 2025

Add internal support to compare UTF16-BE and UTF16-LE strings.

Reason I added this, is because I want to follow up with support Windows registry change files, which are prefixed with Windows Registry Editor Version 5.00, in a UTF16-LE encoded, BOM prefixed text file.

Keeps the code more compact and readable, if we use the actual strings we are comparing.

- Correct BE/LE code BOM code comments
- Increase initial buffer size from 12 to 32 bytes
- Increase signature length with 2 byte (space) in BOM UTF-16 prefixed XML files
@Borewit Borewit self-assigned this Jun 9, 2025
@Borewit Borewit added the debt Technical debt label Jun 9, 2025
@Borewit Borewit requested a review from sindresorhus June 9, 2025 13:05
@Borewit Borewit requested a review from sindresorhus June 10, 2025 15:34
@sindresorhus sindresorhus merged commit 1a9b1bb into main Jun 10, 2025
6 checks passed
@sindresorhus sindresorhus deleted the utf16-string-compare branch June 10, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants