GNOME Bugzilla – Bug 535022
ambiguous width in utf8 locale
Last modified: 2008-05-28 01:49:13 UTC
Please describe the problem: I am using en_US.UTF-8 locale, and set VTE_CJK_WIDTH=1, and I still get half width of ambiguous character. from the source, I see I have to set my locale to ja/ko/vi/zh in order to make ambiguous width into 2. when I using en_US.UTF-8, I cannot make it. I don't think we need to guess since I am setting the env VTE_CJK_WIDTH=1 it is useless. otherwise we have to make a new env such as VTE_AMBIGUOUS_WIDTH=1 for user to force it as 2. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Ugh. I wish we had made it return VTE_CJK_WIDTH directly and if not set, auto detect... But using 1 for autodetect, we can't do that anymore. Committed patch to make VTE_CJK_WIDTH=wide and VTE_CJK_WIDTH=narrow give you full control. Any other value means "auto" based on locale. Please test svn trunk. 2008-05-27 Behdad Esfahbod <behdad@gnome.org> Bug 535022 – ambiguous width in utf8 locale * src/iso2022.c (_vte_iso2022_ambiguous_width): Recognize env var settings VTE_CJK_WIDTH=narrow and VTE_CJK_WIDTH=wide. Any other value means "auto" based on locale, as it was doing previously.
I just check the source code, I think you miss a "return" before _vte_iso2022_ambiguous_width_guess(). ;-) /* * Decide the ambiguous width according to the default region if * current locale is UTF-8. */ if (strcmp (codeset, "utf8") == 0 && g_getenv("VTE_CJK_WIDTH") != NULL) { const char *env = g_getenv ("VTE_CJK_WIDTH"); if (g_ascii_strcasecmp (env, "narrow")) return 1; if (g_ascii_strcasecmp (env, "wide")) return 2; else _vte_iso2022_ambiguous_width_guess (); }
So yeah... Fixed.
I have tested it. But got a strange result. when I export VTE_CJK_WIDTH=narrow, I got the correct result. ambiguous character has wide width. but when I set VTE_CJK_WIDTH=wide, I got narrow result. I have double check the source. There is no others using this enviroment. so I have no idea what is going on.