MB_LEN_MAX has to be more than 5 if mutt uses UTF-8
Hi,
I've just started using mutt-1.5.18 and found that
hcache strings are now converted to UTF-8. (flea#3023)
But it causes a problem on OpenBSD i386 machines
because MB_LEN_MAX==1 there.
(i.e. EUC-JP kanji strings can be truncated.)
Now mutt depends on UTF-8, so MB_LEN_MAX needs to be
at least 6. Therefore I suggest mutt.h checks it.
> diff -r cc67b008038c mutt.h
> --- a/mutt.h Fri Jul 11 11:34:42 2008 +0200
> +++ b/mutt.h Sun Jul 13 22:32:39 2008 +0900
> @@ -53,7 +53,7 @@
> #include "hash.h"
> #include "charset.h"
>
> -#ifndef HAVE_WC_FUNCS
> +#if (!defined(MB_LEN_MAX)) || (MB_LEN_MAX < 16)
> # ifdef MB_LEN_MAX
> # undef MB_LEN_MAX
> # endif
BTW, Changelog tells that 0eacf5297484 was to "prevent
crashes if MB_LEN_MAX<6", but utf8.c is enabled only
"#ifndef HAVE_WC_FUNCS", which means MB_LEN_MAX==16
(see mutt.h). So I'm afraid the change changed nothing.
P.S.
You may wonder why I don't use --without-wc-funcs.
OpenBSD has a serious bug that mbrtowc is not weak_aliased
while its printf uses mbrtowc (compiled as MB_CUR_MAX==1).
http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=5351
--
tamo