summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-05-24 19:18:32 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-05-24 19:18:32 +0000
commit16d853581f96b0bf3e771ac6360d994a2d773899 (patch)
treea22b29aec56e69eeb4ab285aefaf066f4aab0a15
parentf67f031d1862a66c84162dbdcbdb3a6a28e1e9bb (diff)
Make charset-hook work with an external iconv implementation.
-rw-r--r--charset.c7
-rw-r--r--charset.h1
-rw-r--r--compose.c2
-rw-r--r--gnupgparse.c2
-rw-r--r--iconv/iconv.c8
5 files changed, 11 insertions, 9 deletions
diff --git a/charset.c b/charset.c
index e98f49a3..f74f0e2a 100644
--- 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);
}
diff --git a/charset.h b/charset.h
index fa808da9..894cdecd 100644
--- 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;
diff --git a/compose.c b/compose.c
index 034424f2..c8ebae8a 100644
--- 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;
diff --git a/gnupgparse.c b/gnupgparse.c
index ae54dfdd..0800add8 100644
--- a/gnupgparse.c
+++ b/gnupgparse.c
@@ -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;
diff --git a/iconv/iconv.c b/iconv/iconv.c
index c80db52d..280e07c0 100644
--- a/iconv/iconv.c
+++ b/iconv/iconv.c
@@ -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)))