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
'é' is shown as a double-width character #1050
Comments
Handling of locale and character encoding was historically grown and having a number of inconsistencies, so there was a major revision in 3.4.1. Parameters The reason for the changed behaviour is actually that CJK locales with UTF-8 encoding have ambiguous-width double-wide property in cygwin/newlib. I have submitted a newlib patch already to change that and make it consistent with the respective Linux/glibc locales, with no response so far; maybe you'd like to report this to the cygwin mailing list. For now, there are two workarounds in mintty: |
When I set |
I cannot reproduce that. With |
I tried |
Thanks. Would you report the locale issue to the cygwin mailing list (so I don't have to nag about my own patch...)? |
It seems that I found a problem. When I do When I do |
That should be OK as by definition of the locale mechanism, specific LC_ variables override LANG for the respective locale category, and LC_ALL overrides them all.
I could reproduce that an hour ago, but I don't reproduce it anymore. Weird. |
|
Is this condition correct? Lines 457 to 458 in 7573e73
I think LC_CTYPE should be set when LANG is not set or LANG is different from the specified loc value.i.e. if (!lc || strcmp(lc, loc) != 0) |
Hmm, now When I execute this from a command prompt, |
It seems that 7dd20ba causes the issue, but I'm not sure why setting |
Ah, # if no locale variable is set, indicate terminal charset via LANG
test -z "${_LC_ALL_SET_:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale -uU) Therefore, if |
No, the intent is to modify the locale environment as little as possible and only enforce the LC_CTYPE category. |
Actually, this was different until 3.4.0, see https://github.com/mintty/mintty/blob/master/src/child.c#L288. |
Then, I have to set LANG explicitly? |
You don't need to if you don't care about other locale categories. |
The problem is that now |
LANG does not really "become" empty, mintty does not clear it. It is just not set explicitly anymore. |
And, as I tried to point out in my comment before, I do not see this as a problem. |
Hmm, still unclear to me.
So, if I want to set It would be nice if |
Why do you want mintty to set LANG? One alternative I can imagine is to use the |
I actually don't care whether mintty sets LANG or not. I just want LANG is set to the default value when bash is opened. (But the startup script doesn't seem to allow it.) |
The cygwin shell startup scripts look a bit weird to me, but I'm pretty confident that what mintty does now (with the fix you suggested above) is correct for locale setup as far as character encoding is concerned. |
That does not work as /etc/profile.d/lang.sh will not respect such setting but overwrite it from the Windows system locale via |
Trying get problems solved, what do you need LANG for? |
Yes, of course, adding that in ~/.bash_profile can also solve it. Edit: |
I'd still appreciate to know what the benefit of the old behaviour is. |
Or rather like this: if parameter Locale is used, in addition to the current settings, always set LANG to the proper locale value, but do not clear any other LC_ variables in case they were preset on purpose. |
Thank you. I think this behavior is good. |
Adding --- a/docs/mintty.1
+++ b/docs/mintty.1
@@ -1485,7 +1485,7 @@ If you prefer basic locale setup for all categories to be affected by
the LC_CTYPE locale, it is suggested to add the following to the
shell startup scripts:
.br
- LANG="${LC_ALL:-${LC_CTYPE:-$LANG}}"
+ export LANG="${LC_ALL:-${LC_CTYPE:-$LANG}}"
.TP
\fBCharacter set\fP (Charset=) Or, this line might be able to remove, because the behavior is changed by b54f202. |
Amended the comment and moved it above the now final legacy behaviour paragraph. |
Thank you. LGTM! |
Released 3.4.2. |
Recent changes have an unpleasant side effect: default invocation (without Locale option) now leads to setting locale to C.UTF-8 rather than the system locale, e.g. de_DE.UTF-8. Expecting complaints soon, this needs to be fixed. |
Uploaded another fix. Planning to release today, please check. |
It looks almost okay. |
So mintty -o Charwidth=ambig-narrow with no locale environment variable set (like from a shortcut) leads to ja_JP.UTF-8, probably as set by |
Yes, but
Ah, I was not aware that behavior, but that is the same as 3.4.0. |
There's also quite the opposite problem: If you start mintty from scratch (i.e. with empty locale environment, e.g. from desktop) with a CJK system locale detected from Windows in /etc/profile.d/lang.*, your terminal locale will be UTF-8 narrow while your shell locale will be UTF-8 ambig-wide. So backspacing over é will move left one position too far (not in 3.4.2 with that bug... but again with its "fix").
One of us should present the problem to the cygwin mailing list... |
I haven't joined the cygwin mailing list. So, I'll leave it to you. |
Uploaded a workaround for the empty locale situation which is now handled to be consistent with shell initialisation of empty locale (solution 1 above). Testing appreciated. |
I summarized the behavior in a table: |
Thanks a lot for making this overview. |
Thank you for the explanation. I got it. |
Released 3.4.3. |
From mintty 3.4.1, 'é' (U+00E9) is shown as a double-width character.
The text was updated successfully, but these errors were encountered: