Skip to content

fix: preserve Unicode in process command lines#87

Open
tuna4ll wants to merge 1 commit into
microsoft:mainfrom
tuna4ll:fix/unicode-command-line
Open

fix: preserve Unicode in process command lines#87
tuna4ll wants to merge 1 commit into
microsoft:mainfrom
tuna4ll:fix/unicode-command-line

Conversation

@tuna4ll

@tuna4ll tuna4ll commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Fixes Unicode handling for process command lines returned by getProcessList.

Windows exposes process command lines as UTF-16. The native code previously
converted them with the active Windows ANSI code page (CP_ACP), but the
resulting std::string is passed to N-API as UTF-8. Characters outside the
active code page could therefore be replaced or decoded incorrectly.

This change:

  • converts command lines from UTF-16 to UTF-8 using CP_UTF8
  • adds a regression test covering Turkish, Cyrillic, and Chinese characters

Testing

  • npm run compile
  • npm run lint
  • git diff --check
  • npm test

Fixes #76

@tuna4ll

tuna4ll commented Jun 27, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

getProcessList: incorrect handling of multibyte character encoding

1 participant