nmh-workers
[Top] [All Lists]

[Nmh-workers] hardcoded Charset removal

2012-09-17 01:47:36
Hi, uip/mhparse.c contains Charset array, and only charsets included in this 
array
are realized in the mh-profile processing. 

grep-ing files I found Charset is used only in uip/mhparse.c, and
by removing (the very small abount of) the related code nmh can recognize
any charset related directives in mh-profile.
attached below is the patch to remove Charset related code.

h/mhparse.h includes CHARSET_LATIN and I believe it can be also removed.
the patch below does not touch h/mhparse.h.

any comments?

my motivation is the following;
    o I want to write directives mhshow-charset-iso-2022-jp, 
mhshow-charset-shift_jis, etc
      in .mh_profile
    o I don't want to invoke another terminal window; I prefer to convert the 
charset encoding
      (e.g., apply "iconv -f iso-2022-jp-2 -t utf-8" to contents)

-- yozo.


--- uip/mhparse.c.orig  Mon Jun  4 04:37:11 2012
+++ uip/mhparse.c       Mon Sep 17 14:34:34 2012
@@ -48,11 +48,7 @@
     { NULL,       TEXT_UNKNOWN }    /* this one must be last! */
 };
 
-struct k2v Charset[] = {
-    { "us-ascii",   CHARSET_USASCII },
-    { "iso-8859-1", CHARSET_LATIN },
-    { NULL,         CHARSET_UNKNOWN }  /* this one must be last! */
-};
+/* Charset[] removed -- yozo.  Mon Sep 17 14:33:56 +0900 2012
 
 /*
  * Structures for MULTIPART messages
@@ -1079,14 +1075,7 @@
 
     /* 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;
-           }
-       }
-       t->tx_charset = kv->kv_value;
+       chset = *ep;
     } else {
        t->tx_charset = CHARSET_UNSPECIFIED;
     }

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>