[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-workers] mhshow not honoring charset spec
From: |
Anders Eriksson |
Subject: |
[Nmh-workers] mhshow not honoring charset spec |
Date: |
Sun, 23 Aug 2009 22:38:07 +0200 |
I'm having a go at teaching nmh to show various charsets properly on
my UTF-8 terminal using iconv. No luck, though. :-( It seems that the
only mhshow-charset-xxx entries that are recognized are for
xxx == iso-8859-1.
What I have is this:
showproc: mhshow
mhshow-show-text/plain: cat
mhshow-charset-iso-8859-1: %s | iconv -f iso-8859-1 -t utf-8 | less
It does the trick for an iso-8859-1 message. Changing the "-1" with "-9"
and testing with a an iso-8859-9 message makes it use the normal pager
(less) on the body. My initial suspicion was that it somehow thought that
iso-8859-9 was the native locate, so I started to look into the code,
and ended up looking at this in mhparse.c:
struct k2v Charset[] = {
{ "us-ascii", CHARSET_USASCII },
{ "iso-8859-1", CHARSET_LATIN },
{ NULL, CHARSET_UNKNOWN } /* this one must be last! */
};
...which seems to be used to compare against the charset in the message:
/* check if content specified a character set */
if (*ap) {
/* match character set or set to CHARSET_UNKNOWN */
for (kv = Charset; kv->kv_key; kv++) {
if (!mh_strcasecmp (*ep, kv->kv_key)) {
chset = *ep;
break;
}
}
...and this is used here:
* If we can not handle character set natively,
* then check profile for string to modify the
* terminal or display method.
*
* termproc is for mhshow, though mhlist -debug prints it, too.
*/
if (chset != NULL && !check_charset (chset, strlen (chset))) {
snprintf (buffer, sizeof(buffer), "%s-charset-%s", invo_name, chset);
if ((cp = context_find (buffer)))
ct->c_termproc = getcpy (cp);
}
I don't claim to understand all the details here, but it seems that
(and sprinkling printf's confirm) that chset is only set if a well-known
charset is used, and _then_ we go look for a mhshow-charset-xxx entry ??
I've seen no other reports on this on the net, but quite a few posts
suggesting that any random charset can be handled using mhshow-charset-xxx
so I'm guessing I've gotten something backwards.
All pointers appreciated,
-Anders
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-workers] mhshow not honoring charset spec,
Anders Eriksson <=