[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] hardcoded Charset removal
From: |
Yozo TODA |
Subject: |
Re: [Nmh-workers] hardcoded Charset removal |
Date: |
Mon, 08 Oct 2012 03:24:11 +0900 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Sorry for the late response.
> > Thank you for analyzing this and providing a patch. I
> > have one question. The patch removes the setting of
> > t->tx_charset. Should we retain that? It's used in
> > mhbuild, I believe.
tx_charset is referred only in uip/mhbuildsbr.c to see
if charset is specified or not.
There's no other place to check the value of tx_charset.
Anyway, initializing tx_charset with some value makes the code
safer and understandable (-:
We need only CHARSET_SPECIFIED and CHARSET_UNSPECIFIED, and
can remove the definition of CHARSET_{UNKNOWN,USASCII,LATION}.
Attached below is the revised patch for 3 files
h/mhparse.h
uip/mhbuildsbr.c
uip/mhparse.c
> What should mhbuild do if a draft contains an explicit
> charset="us-ascii" definition but contains 8-bit characters? Currently
> we end up with two definitions for charset. Should it just ignore the
> charset or should it perhaps generate an error?
The current code prefer to use the explicit definition in the draft;
8bit-character-content can be produced with header charset="us-ascii".
I can say there's no problem in nmh here, drafts should be written properly.
Meanwhile, I understand an opinion that nmh should check the inconsistency
as far as possible.
I wonder which behavior do the majority of nmh users choose?
-- yozo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (OpenBSD)
iQEcBAEBCgAGBQJQccfZAAoJEP/N++OXMoyDoxQH/RbIHr7Q6V4mJZUsxA+UUfML
YxXglcmuBiTcWXfoacsIUv4A9G9qQDpwO3OK1Jfmr6EnDtIHUZZbRolgBhlxjURL
nmhJj3QTV6Mzxt/2WfovzSM4nVsa39Bymsmevb9kde92EaECL5mRzVziW7pMSZh7
X5IjtiJygQZNrSXrIDosVNVUBwpgQEhc+FfO3nraYAijWLGrin9AovpZIFGE2dF1
UwiQRLg5ZnC4ylaZ0MqkP4oGkMR4uBZcI3etxeNt46V+41flK84XX53Xggau7e00
VOOlKVZRwVAMFqXL71v9XJaUyCC1gcTp2rrfMU5SgNQ4XJsza5Y1acMJv5LS134=
=+mLU
-----END PGP SIGNATURE-----
======================================================================
--- h/mhparse.h.orig 2012-02-05 13:16:59.000000000 +0900
+++ h/mhparse.h 2012-10-08 01:02:25.000000000 +0900
@@ -162,10 +162,8 @@
#define TEXT_ENRICHED 0x03
/* Flags for character sets */
-#define CHARSET_UNKNOWN 0x00
+#define CHARSET_SPECIFIED 0x00
#define CHARSET_UNSPECIFIED 0x01 /* only needed when building drafts */
-#define CHARSET_USASCII 0x01
-#define CHARSET_LATIN 0x02
/* Structure for text content */
struct text {
--- uip/mhbuildsbr.c.orig 2012-06-11 13:06:19.000000000 +0900
+++ uip/mhbuildsbr.c 2012-10-08 01:08:09.000000000 +0900
@@ -1314,12 +1314,11 @@
continue;
if (contains8bit) {
- t->tx_charset = CHARSET_UNKNOWN;
*ap = concat ("charset=", write_charset_8bit(), NULL);
} else {
- t->tx_charset = CHARSET_USASCII;
*ap = add ("charset=us-ascii", NULL);
}
+ t->tx_charset = CHARSET_SPECIFIED;
cp = strchr(*ap++, '=');
*ap = NULL;
--- uip/mhparse.c.orig 2012-06-04 04:37:11.000000000 +0900
+++ uip/mhparse.c 2012-10-08 01:05:09.000000000 +0900
@@ -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 Oct 8 01:03:41 JST 2012 */
/*
* Structures for MULTIPART messages
@@ -1079,14 +1075,8 @@
/* 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;
+ t->tx_charset = CHARSET_SPECIFIED;
} else {
t->tx_charset = CHARSET_UNSPECIFIED;
}
======================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Nmh-workers] hardcoded Charset removal,
Yozo TODA <=