Sdk: dotnet cli produces `?`s in output

Created on 26 Oct 2017  Β·  12Comments  Β·  Source: dotnet/sdk

Steps to reproduce

Run dotnet --help

Expected behavior

Readable text should output.

Actual behavior

????????? ????????? ?????? .NET (2.0.2)
?????????????: dotnet [runtime-options] [path-to-application]
?????????????: dotnet [sdk-options] [command] [arguments] [command-options]

path-to-application:
  ???? ? DLL-????? ??????????, ??????? ?????????? ?????????.

??????? SDK:
  new              ????????????? ???????? .NET.
  restore          ?????????????? ????????????, ????????? ? ???????? .NET.
  run              ?????????? ? ??????????? ?????????? ??????? .NET.
  build            ?????? ??????? .NET.
  publish          ?????????? ??????? .NET ??? ????????????? (??????? ????? ??????????).
  test             ?????????? ?????? ? ??????? ???????? ?????????? ??????, ?????????? ? ???????.
  pack             ???????? ?????? NuGet.
  migrate          ???????? ??????? ?? ?????? project.json ? ?????? ?? ?????? msbuild.
  clean            ??????? ???????? ?????? ??????.
  sln              ????????? ?????? ??????? (SLN).
  add              ?????????? ?????? ? ??????.
  remove           ???????? ?????? ?? ???????.
  list             ?????? ?????? ? ???????.
  nuget            ?????????????? ?????????????? ?????? NuGet.
  msbuild          ?????? Microsoft Build Engine (MSBuild).
  vstest           ?????? ????????? ????????? ?????? ?????????? ??? ?????????? ??????.

????? ?????????:
  -v|--verbosity        ????????? ?????? ??????????? ??? ???????. ?????????? ????????: q[uiet], m[inimal], n[ormal], d[etailed] ? diag[nostic].
  -h|--help             ???????? ???????.

????????? ??????? "dotnet ??????? --help" ??? ????????? ?????????????? ?????????? ? ???????.

sdk-options:
  --version        ??????????? ?????? ?????? SDK ??? .NET Core.
  --info           ??????????? ???????? ? .NET Core.
  -d|--diagnostics ????????? ???????? ?????? ???????????.

runtime-options:
  --additionalprobingpath <path>    ???? ? ???????? ???????? ? ??????????? ???????.
  --fx-version <version>            ?????? ????????????? ????? ?????????, ??????? ??????? ???????????? ??? ??????? ??????????.
  --roll-forward-on-no-candidate-fx ???? ????????????? ????? ????????? ?? ????????, ??????????? ?????.
  --additional-deps <path>          ???? ? ??????????????? ????? deps.json.

Environment data

dotnet --info output:

????????? ????????? ?????? .NET (2.0.2)

Product Information:
 Version:            2.0.2
 Commit SHA-1 hash:  a04b4bf512

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Most helpful comment

To summarize and add more detail, this issue can happen if you're "language for non-Unicode programs" (console counts as one of those) / "System locale" does not match the Windows display language.

To fix that:

  1. Start ->Control Panel
  2. Clock, Language and Region
  3. Region
  4. Administrative tab
  5. Language for non-Unicode programs -> Change system locale
  6. Pick a language that matches Windows' display language

Also check that your command prompt is using a font that supports the characters in your display language:

  1. Start -> Command Prompt
  2. Click on command prompt icon in top left of window
  3. Properties
  4. Select an appropriate font

Alternatively, to force the CLI to English set environment variable DOTNET_CLI_UI_LANGUAGE=en-US

All 12 comments

Are you using a specific language here?

cc @nguerrera seems like a problem with localization or localized content.

Yes, what is the Windows UI langauge and what is the output of chcp. This can happen if there is a mismatch.

Another problem could be the console font that is used. What is it?

@nguerrera Windows UI language is Russian. I'm not sure about chcp, I will clarify it tomorrow (I'm away from work PC at the moment).

The issue probably is not in console font. It reproduces in cmd, powershell and VS Code Integrated Terminal (which is set to be powershell), but ordinary Cyrillic (like paths or command line arguments) displays just fine there.

and what is the output of chcp

@nguerrera

PS C:\Users\Victor> chcp
Active code page: 437

It helps if I set chcp 1251 for current session, but after restart code page resets.
How can I change UI language to English for dotnet CLI?

I've managed to fix default code page by changing language from English to Russian in Language for non-Unicode programs somewhere in regional settings. But that was not obvious nor easy to discover.

Can dotnet CLI fall back to English UI if it detects issues with code page on start? How can I manually force its language to English? (You know, for programmers it's such a painΒ β€” localized exception messages and interface of console programs.)

To summarize and add more detail, this issue can happen if you're "language for non-Unicode programs" (console counts as one of those) / "System locale" does not match the Windows display language.

To fix that:

  1. Start ->Control Panel
  2. Clock, Language and Region
  3. Region
  4. Administrative tab
  5. Language for non-Unicode programs -> Change system locale
  6. Pick a language that matches Windows' display language

Also check that your command prompt is using a font that supports the characters in your display language:

  1. Start -> Command Prompt
  2. Click on command prompt icon in top left of window
  3. Properties
  4. Select an appropriate font

Alternatively, to force the CLI to English set environment variable DOTNET_CLI_UI_LANGUAGE=en-US

Can dotnet CLI fall back to English UI if it detects issues with code page on start? How can I manually force its language to English? (You know, for programmers it's such a pain β€” localized exception messages and interface of console programs.)

Yes, MSBuild does that here:
https://github.com/Microsoft/msbuild/blob/f9183fddd15e728d52dbeb4716d1d43f2f5541d4/src/MSBuild/XMake.cs#L1359-L1386

This is actually documented internally as what we should be doing but we're not following the guideline. This is how we should fix this. I believe we have other tools including the compilers that may also need this change. cc @tmeschter

Hi. Coming from dotnet/cli#8685

What I don't understand is why is non-unicode setting getting involved? Fall back to English would be nice, but doesn't the dotnet cli print unicode characters, which could also display Russian or Japanese or any other character? I may be too inexperienced in character encoding to understand what the right solution is. Changing the non-unicode setting seems like a workaround and not a permanent solution. Powershell should have no problem handling unicode character at this age.

@nguerrera

Alternatively, to force the CLI to English set environment variable DOTNET_CLI_UI_LANGUAGE=en-US

Doesn't work for me. In Git Bash (on Windows):

$ DOTNET_CLI_UI_LANGUAGE=en-US

$ echo $DOTNET_CLI_UI_LANGUAGE
en-US

$ dotnet --info
ΠŸΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹ ΠΊΠΎΠΌΠ°Π½Π΄Π½ΠΎΠΉ строки .NET (2.1.103)

Product Information:
 Version:            2.1.103
 Commit SHA-1 hash:  60218cecb5

Take a look at description, it is still in Cyrillic: β€œΠŸΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹ ΠΊΠΎΠΌΠ°Π½Π΄Π½ΠΎΠΉ строки .NET (2.1.103)”

@qbit86 I believe you need to use export. In my git bash:

$ dotnet --info
.NET Command Line Tools (2.1.300-preview2-008251)

Product Information:
 Version:            2.1.300-preview2-008251
 Commit SHA-1 hash:  94fd3fd392

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-preview2-008251\

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview2-26131-06
  Build    : b13a0d5c331f374afd35ded57b9a4b4ab128864c


$ DOTNET_CLI_UI_LANGUAGE=ru-RU

$ dotnet --info
.NET Command Line Tools (2.1.300-preview2-008251)

Product Information:
 Version:            2.1.300-preview2-008251
 Commit SHA-1 hash:  94fd3fd392

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-preview2-008251\

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview2-26131-06
  Build    : b13a0d5c331f374afd35ded57b9a4b4ab128864c


$ export DOTNET_CLI_UI_LANGUAGE=ru-RU

$ dotnet --info
????????? ????????? ?????? .NET (2.1.300-preview2-008251)

Product Information:
 Version:            2.1.300-preview2-008251
 Commit SHA-1 hash:  94fd3fd392

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-preview2-008251\

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview2-26131-06
  Build    : b13a0d5c331f374afd35ded57b9a4b4ab128864c

Note that my git bash console window is not configured for Unicode, so it displays question marks instead of Cyrillic.

I believe you need to use export.

@svick Thanks, it does solve the issue!

@nguerrera Thanks for your sharing. It works for me!

Was this page helpful?
0 / 5 - 0 ratings