-
Notifications
You must be signed in to change notification settings - Fork 11
Optimize stdout&stderr decoding for Windows ANSI Code Page #16
Copy link
Copy link
Open
Description
This is actually is NOT a PR, but a suggestion.
I have seen whole content of issue #9, and changes in
Line 44 in 6e18ee8
| static async enableUnicode() { |
cmd.exe /c chcp has side effect, and I think it should be the only choice.In our own application we have implemented a function
ChangeCodePage by using node-ffi:
const ChangeCodePage = (buffer, options = {}) => {
const {
fromCodePage = 'acp',
toCodePage = 'utf8',
toString = true,
nullTerminated = false,
} = options;
// using Windows API WideCharToMultiByte and MultiByteToWideChar
return WideCharToMultiByte(MultiByteToWideChar(buffer, fromCodePage), {
encoding: toCodePage,
toString,
nullTerminated,
});
};So, if there is a Registry.decodeStdout option, life would be much easier!
💯
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels