Skip to content

Commit

Permalink
Set the console code page to "UTF-8" (#6274)
Browse files Browse the repository at this point in the history
* set the console code page to "UTF-8"

* Merge fix

* Some more changes

* Version bump up
  • Loading branch information
thesattiraju authored Mar 20, 2018
1 parent 0d58646 commit 185f958
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
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();

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

0 comments on commit 185f958

Please sign in to comment.