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

cargo tree character encoding problem #8369

Closed
alilleybrinker opened this issue Jun 16, 2020 · 3 comments
Closed

cargo tree character encoding problem #8369

alilleybrinker opened this issue Jun 16, 2020 · 3 comments
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-bug Category: bug Command-tree S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@alilleybrinker
Copy link

Problem

When running cargo tree (Cargo version 1.44.0) in Git Bash on Windows 10, I get output that looks like the following (snippet of actual output):

Γö£ΓöÇΓöÇ anyhow v1.0.30
Γö£ΓöÇΓöÇ chrono v0.4.11
Γöé   Γö£ΓöÇΓöÇ num-integer v0.1.42
Γöé   Γöé   ΓööΓöÇΓöÇ num-traits v0.2.11
Γöé   Γöé       [build-dependencies]
Γöé   Γöé       ΓööΓöÇΓöÇ autocfg v1.0.0
Γöé   Γöé   [build-dependencies]
Γöé   Γöé   ΓööΓöÇΓöÇ autocfg v1.0.0
Γöé   Γö£ΓöÇΓöÇ num-traits v0.2.11 (*)
Γöé   Γö£ΓöÇΓöÇ serde v1.0.110

Steps

  1. Open Git Bash on Windows 10
  2. Navigate to Rust crate
  3. Run cargo tree

Possible Solution(s)

It certainly looks like a character encoding issue but I don't know enough to say more than that.

Notes

Output of cargo version: cargo 1.44.0 (05d080faa 2020-05-06)
Output of rustc --version: rustc 1.44.0 (49cae5576 2020-06-01)
Git Bash MinTTY version: 3.1.6 (x86_64-pc-msys)

@alilleybrinker alilleybrinker added the C-bug Category: bug label Jun 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Jun 16, 2020

This seems to be a recent regression in MinTTY. See git-for-windows/git#2648 and msys2/MSYS2-packages#1974. It looks like there might be some workarounds noted in those issues, or you can run cargo tree --charset=ascii for now.

@alilleybrinker
Copy link
Author

Huh. Thanks for the explanation and workaround!

@ehuss ehuss added A-console-output Area: Terminal output, colors, progress bar, etc. Command-tree S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix labels Jun 25, 2020
@dscho
Copy link

dscho commented Sep 1, 2020

Seems that there is a work-around: cmd //c chcp 65001, but I think we have a good grasp on msys2/MSYS2-packages#1974 and once that is resolved, this here bug will be fixed, too.

dscho added a commit to dscho/msys2-runtime that referenced this issue Sep 1, 2020
When `LANG=en_US.UTF-8`, the detected `LCID` is 0x0409, which is
correct, but after that (at least if Pseudo Console support is enabled),
we try to find the default code page for that `LCID`, which is ASCII
(437). Subsequently, we set the Console output code page to that value,
completely ignoring that we wanted to use UTF-8.

Let's not ignore the specifically asked-for UTF-8 character set.

While at it, let's also set the Console output code page even if Pseudo
Console support is disabled; contrary to the behavior of v3.0.7, the
Console output code page is not ignored in that case.

The most common symptom would be that console applications which do not
specifically call `SetConsoleOutputCP()` but output UTF-8-encoded text
seem to be broken with v3.1.x when they worked plenty fine with v3.0.x.

This fixes msys2/MSYS2-packages#1974,
msys2/MSYS2-packages#2012,
rust-lang/cargo#8369,
git-for-windows/git#2734,
git-for-windows/git#2793,
git-for-windows/git#2792, and possibly quite a
few others.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-bug Category: bug Command-tree S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

3 participants