Re: [Mutt] #3040: charset difference between index browser and pager
#3040: charset difference between index browser and pager
Comment (by Alain Bench):
{{{
Hello Kyle,
On Thursday, March 20, 2008 at 11:51:33 -0500, Kyle Wheeler wrote:
> On Thursday, March 20 at 03:47 PM, quoth Vincent Lefevre:
>> set charset=`codeset 2> /dev/null || locale charmap`//TRANSLIT
> it isn't particularly portable...
While neither universally portable, there is a pair of alternatives.
First the Mutt-only, nice, but fails with non-recent Mutts, in UTF-8,
and on -HAVE_LANGINFO_CODESET systems:
| :set &charset my_charset="$charset//TRANSLIT" charset="$my_charset"
&my_charset ?charset
The other is using locale_charset() from libcharset, libiconv,
gettext, or whatever, and should be portable to a whole lot of systems.
Christian tested it OK on MacOS-X. Shouts canonical charset names even
on weird systems. Fails UTF-8. Needs to install the attached
locale_charset.c command.
> mutt makes the mistake of assuming that $charset is a good fall-back
> that will always be a valid MIME charset encoding name.
The assumption is that when all normal mechanisms fail, there is
nothing more appropriate to do than send $charset unconverted. That's a
last resort fallback. It should not happen in a sane setup.
If there is something better to do, then it should be done. For now,
I only see stripping //SUFFIXES from sent label. And validating the
charset settings of the user.
Bye! Alain.
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/3040#comment:>