-
Notifications
You must be signed in to change notification settings - Fork 228
win32 platform support not utf8 encoding at childProcess.spawn() stdout/stderr #364
Conversation
@lialosiu, It will cover your contributions to all Microsoft-managed open source projects. |
@lialosiu This is a helpful fix. On the other hand, could we make this as a more general fix but not only for Chinese? |
@lialosiu, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
@yaohaizh I think yes, but I don't know how many codepage should we add. maybe we need something to match the encoding name like |
child.stderr.on("data", (data) => { outputChannel.append(data.toString()); }); | ||
child.stdout.on("data", (data: Buffer) => { | ||
switch (codepage) { | ||
case "932": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, I would suggest use a config file called (codepageMapping.json) which we can put under ./msci folder as mapping files. (The folder name might be changed later.)
If can find the codepage from the mapping, just convert it. Otherwise use the default one.
outputChannel.append(data.toString()); | ||
break; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the duplication, the code is better to implement on the outputChannel side.
In version 0.2.5 for cp866, the output looks the same. The fix did not work. |
sorry about my poor English first..... m(_ _)m
When I use vscode-arduino at Chinese Windows system, output encoding is broken.
because Windows non-unicode app return by ansi.
so we can get ansi codepage, and use iconv-lite to decode it to utf8.