Skip to content
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

Set the console code page to "UTF-8" #6274

Merged
merged 7 commits into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"loc.input.label.workingDirectory": "Working Directory",
"loc.input.help.workingDirectory": "Current working directory where the script is run. Empty is the root of the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory)",
"loc.messages.BuildIdentityPermissionsHint": "For internal feeds, make sure the build service identity '%s' [%s] has access to the feed.",
"loc.messages.CouldNotSetCodePaging": "Could not set the code paging of due to following error: %s",
"loc.messages.Error_AutomaticallyVersionReleases": "Autoversion: Getting version number from build option is not supported in releases",
"loc.messages.Error_CommandNotRecognized": "The command %s was not recognized.",
"loc.messages.Error_NoSourceSpecifiedForPush": "No source was specified for push",
Expand Down
13 changes: 13 additions & 0 deletions Tasks/DotNetCoreCLI/dotnetcore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class dotNetExe {

public async execute() {
tl.setResourcePath(path.join(__dirname, "task.json"));
this.setConsoleCodePage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this actually be handled in task-lib?


switch (this.command) {
case "build":
Expand Down Expand Up @@ -58,6 +59,18 @@ export class dotNetExe {
}
}

private setConsoleCodePage() {
// set the console code page to "UTF-8"
if (tl.osType() === 'Windows_NT') {
try {
tl.execSync(path.resolve(process.env.windir, "system32", "chcp.com"), ["65001"]);
}
catch (ex) {
tl.warning(tl.loc("CouldNotSetCodePaging", JSON.stringify(ex)))
}
}
}

private async executeBasicCommand() {
var dotnetPath = tl.which("dotnet", true);

Expand Down
3 changes: 2 additions & 1 deletion Tasks/DotNetCoreCLI/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 132,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "dotnet $(command)",
Expand Down Expand Up @@ -471,6 +471,7 @@
},
"messages": {
"BuildIdentityPermissionsHint": "For internal feeds, make sure the build service identity '%s' [%s] has access to the feed.",
"CouldNotSetCodePaging": "Could not set the code paging of due to following error: %s",
"Error_AutomaticallyVersionReleases": "Autoversion: Getting version number from build option is not supported in releases",
"Error_CommandNotRecognized": "The command %s was not recognized.",
"Error_NoSourceSpecifiedForPush": "No source was specified for push",
Expand Down
3 changes: 2 additions & 1 deletion Tasks/DotNetCoreCLI/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 132,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down Expand Up @@ -471,6 +471,7 @@
},
"messages": {
"BuildIdentityPermissionsHint": "ms-resource:loc.messages.BuildIdentityPermissionsHint",
"CouldNotSetCodePaging": "ms-resource:loc.messages.CouldNotSetCodePaging",
"Error_AutomaticallyVersionReleases": "ms-resource:loc.messages.Error_AutomaticallyVersionReleases",
"Error_CommandNotRecognized": "ms-resource:loc.messages.Error_CommandNotRecognized",
"Error_NoSourceSpecifiedForPush": "ms-resource:loc.messages.Error_NoSourceSpecifiedForPush",
Expand Down