diff options
author | Eduardo Chappa <chappa@washington.edu> | 2017-10-27 19:58:49 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2017-10-27 19:58:49 -0600 |
commit | 992045e7f3da4519e0820502bb78513ba373d903 (patch) | |
tree | 9da70fc9feb4b0092ee8283a1118ce3799ab6fe1 /alpine/alpine.c | |
parent | 18b1d6453b921627ee4802a33d9e22aa0dcaaf0a (diff) | |
download | alpine-992045e7f3da4519e0820502bb78513ba373d903.tar.xz |
* When the locale is not set up to UTF-8, alpine might determine the width
of a character incorrectly. Reported by Alexandre Fedotov.
Diffstat (limited to 'alpine/alpine.c')
-rw-r--r-- | alpine/alpine.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/alpine/alpine.c b/alpine/alpine.c index 022fc54b..a9c9158a 100644 --- a/alpine/alpine.c +++ b/alpine/alpine.c @@ -312,9 +312,14 @@ main(int argc, char **argv) * in the screen, so this is not necessary to do in Window, and * using pith_ucs4width does not produce the correct result */ -#ifndef _WINDOWS - mail_parameters(NULL, SET_UCS4WIDTH, (void *) pith_ucs4width); -#endif /* _WINDOWS */ +#if !defined(_WINDOWS) && defined(LC_CTYPE) + { char *s; + if((s = setlocale(LC_CTYPE, "")) != NULL + && strlen(s) >= 5 + && !strucmp(s+strlen(s)-5, "UTF-8")) + mail_parameters(NULL, SET_UCS4WIDTH, (void *) pith_ucs4width); + } +#endif /* !_WINDOWS && LC_CTYPE */ mail_parameters(NULL, SET_QUOTA, (void *) pine_parse_quota); /* set some default timeouts in case pinerc is remote */ mail_parameters(NULL, SET_OPENTIMEOUT, (void *)(long)30); |