]> granicus.if.org Git - mutt/commitdiff
Make charset-hook work with an external iconv implementation.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 24 May 2000 19:18:32 +0000 (19:18 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 24 May 2000 19:18:32 +0000 (19:18 +0000)
charset.c
charset.h
compose.c
gnupgparse.c
iconv/iconv.c

index e98f49a3a7b31d2c9568b4542789e95418699b62..f74f0e2a80687da54170a6bb984f7ec7a59c0bef 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -79,9 +79,16 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode)
 {
   char tocode1[SHORT_STRING];
   char fromcode1[SHORT_STRING];
+  char *tmp;
 
   mutt_canonical_charset (tocode1, sizeof (tocode1), tocode);
+  if ((tmp = mutt_charset_hook (tocode1)))
+    mutt_canonical_charset (tocode1, sizeof (tocode1), tmp);
+
   mutt_canonical_charset (fromcode1, sizeof (fromcode1), fromcode);
+  if ((tmp = mutt_charset_hook (fromcode1)))
+    mutt_canonical_charset (fromcode1, sizeof (fromcode1), tmp);
+
   return iconv_open (tocode1, fromcode1);
 }
 
index fa808da956c7c20ddabdd49a71363f1dcf527b92..894cdecd37ffea3f1fd60426446738332fd2717a 100644 (file)
--- a/charset.h
+++ b/charset.h
@@ -57,6 +57,7 @@ int mutt_recode_file (const char *, const char *, const char *);
 
 int mutt_convert_string (char **, const char *, const char *);
 
+iconv_t mutt_iconv_open (const char *, const char *);
 size_t mutt_iconv (iconv_t, const char **, size_t *, char **, size_t *, const char **, const char *);
 
 typedef void * FGETCONV;
index 034424f27d6b8d9b5c6d209711fd5d9d12c32ab4..c8ebae8a7cce6a7a6fc399d6c3c18d08348f30c3 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -402,7 +402,7 @@ static int change_attachment_charset (BODY *b)
   if (mutt_get_field (_("Enter character set: "), buff, sizeof(buff), 0) == -1)
     return 0;
 
-  if ((cd = iconv_open (buff, "us-ascii")) == (iconv_t)-1)
+  if ((cd = mutt_iconv_open (buff, "us-ascii")) == (iconv_t)-1)
   {
     mutt_error (_("Character set %s is unknown."), buff);
     return 0;
index ae54dfdd8c173b91ae4c60cfbe7d375a1e68d49e..0800add8d379aa7df1e24ce48cad8efb2ed8b563 100644 (file)
@@ -87,7 +87,7 @@ static void fix_uid (char *uid)
   }
   *d = '\0';
 
-  if (_chs && (cd = iconv_open (_chs, "utf-8")) != (iconv_t)-1) 
+  if (_chs && (cd = mutt_iconv_open (_chs, "utf-8")) != (iconv_t)-1) 
   {
     int n = s - uid + 1; /* chars available in original buffer */
     char *buf;
index c80db52d09ed32dad4b42da46d1c6cdb1fc49719..280e07c03724f2f7fe1bdb5d26557cde4a6e27b5 100644 (file)
@@ -656,19 +656,13 @@ static CHARSET *mutt_get_charset (const char *name)
   CHARSET *charset;
   char buffer[SHORT_STRING];
   char *real_charset;
-  char *hooked;
-  
+
   if (!name || !*name)
     return (NULL);
 
   init_charsets();
   mutt_canonical_charset (buffer, sizeof(buffer), name);
 
-  /* needs to be documented */
-  
-  if ((hooked = mutt_charset_hook (buffer)))
-    mutt_canonical_charset (buffer, sizeof (buffer), hooked);
-
   dprint (2, (debugfile, "mutt_get_charset: Looking for %s\n", buffer));
   
   if(!CharsetAliases || !(real_charset = hash_find(CharsetAliases, buffer)))