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

3.1b1 Unicode wide char issue when built with Nix #6584

Closed
cole-h opened this issue Feb 12, 2020 · 3 comments
Closed

3.1b1 Unicode wide char issue when built with Nix #6584

cole-h opened this issue Feb 12, 2020 · 3 comments
Labels
bug Something that's not working as intended regression Something that used to work, but was broken, especially between releases
Milestone

Comments

@cole-h
Copy link

cole-h commented Feb 12, 2020

When building the 3.1b1 "release" with Nix, the resulting binary displays the following warning when the prompt contains a unicode character such as λ or **:

<W> fish: Tried to print invalid wide character string

Bisecting the issue, this problem appears to have been introduced with 5134949. 9715db9 (the previous commit) doesn't display this problem.

Something to note is that this issue does not occur when building outside of a Nix environment (aka as detailed in the README) -- the specified characters fail to display at all. It is entirely possible this is a problem with my system due to the fact that it is not pure NixOS and instead Nix + Arch, but I figured the people who would know best are you.

**Note: I tested both Starship and Pure prompts, and both exhibited this behavior. (any Unicode character exhibits this problem)

STR

  1. Build fish-shell with Nix (default.nix to be built with nix-build)
  2. Run sh -c 'env HOME=$(mktemp -d) ./result/bin/fish'
  3. Run function fish_prompt; echo λ; end
  4. <W> fish: Tried to print invalid wide character string

For what it's worth, the message on master (6682f0e) is:

warning: Tried to print invalid wide character string
@faho
Copy link
Member

faho commented Feb 12, 2020

So the underlying issue here seems to be that your locale is not unicode capable, which is broken if you want to use non-ascii characters.

Fix that, and you'll get the actual output as opposed to it failing to display at all.

The commit you highlighted just added an error message. Which seems excessive (and we've removed such errors previously), so I'm dropping it down to a debug message, which we can then direct people to turn on if we suspect it's an issue.


Run starship init fish | source (or set up Pure; I figured Starship was easier to demonstrate)

I think we can boil this down to just function fish_prompt; echo λ; end.

faho added a commit to faho/fish-shell that referenced this issue Feb 12, 2020
Made fish unusable if the locale was C and non-ascii chars were in the
prompt.

See fish-shell#6584.
faho added a commit that referenced this issue Feb 12, 2020
Super annoying in a C locale if the prompt contains non-ascii chars.

See #6584
@faho faho closed this as completed in f44f9f1 Feb 12, 2020
@zanchey zanchey added bug Something that's not working as intended regression Something that used to work, but was broken, especially between releases labels Feb 12, 2020
@faho
Copy link
Member

faho commented Feb 12, 2020

407a9e2 in 3.1 drops the message down to debug level 3 (0 is error, 1 is warning).

In master f44f9f1 sets it to a new debug category "output-invalid".

But still, the real fix is to fix your locale, to make it unicode capable.

@zanchey zanchey added this to the fish 3.1.0 milestone Feb 12, 2020
@cole-h
Copy link
Author

cole-h commented Feb 12, 2020

Definitely less annoying, now. Thanks for the fact action! I was more confused about why this wasn't a problem for anything prior to that specific commit. Looks like I'll have to go back to the totally-uncool > prompt.


As I suspected, it's an odd issue due to using Nix but not NixOS (locales are a bit touchy; see: NixOS/nixpkgs#6878 and nix-community/home-manager#354).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended regression Something that used to work, but was broken, especially between releases
Projects
None yet
Development

No branches or pull requests

3 participants