-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exec task unicode fix #143
Exec task unicode fix #143
Conversation
- On an OS >= Windows 7 (v6.1), the Exec command will now using UTF-8 (w/o BOM) encoding for Console output and writing the temporary .cmd file. This will enable non-ansi characters in the Command property to work as expected. - Added a unit test to cover the scenario.
LGTM. |
if (EncodingUtilities.CurrentSystemOemEncoding.CodePage != sw.Encoding.CodePage) | ||
{ | ||
// Output to nul so we don't change output and logs. | ||
sw.WriteLine($"chcp {sw.Encoding.CodePage}>nul"); |
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.
You're using C#6 features here, is the solution already updated to that?
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.
Good point, probably best to just not go there at this point. Especially for a single change and I'm not sure what it would do to the xplat / Xamarin Studio story when this gets merged.
Left some comments, LGTM otherwise (though I'd preferred if the reformatting of the properties etc. were done in a separate commit, so the real change is easier to see). |
[2019-08] Update SDKs to track vs16.4 and `.NET Core 3.1 Dev`
Fixes #142 and probably #104 (thanks @akoeplinger for pointing that out!).
Definitely not an expect on code pages and cmd.exe encoding, but this works better than previously in all the scenarios I tested.
The only remaining encoding issue I found is if the command you run has non-ansi characters (e.g.
echo 创建
was the test case I used), it will still show up as ?? on the console. I don't think that can be fixed here though.