]> granicus.if.org Git - neomutt/commitdiff
iconv-hook.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 14 Feb 2001 23:35:28 +0000 (23:35 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 14 Feb 2001 23:35:28 +0000 (23:35 +0000)
32 files changed:
charset.c
configure.in
contrib/Makefile.in
contrib/iconv/README [new file with mode: 0644]
contrib/iconv/iconv.aix-3.2.5.rc [new file with mode: 0644]
contrib/iconv/iconv.aix-4.1.5.rc [new file with mode: 0644]
contrib/iconv/iconv.aix-4.2.0.rc [new file with mode: 0644]
contrib/iconv/iconv.aix-4.3.2.rc [new file with mode: 0644]
contrib/iconv/iconv.freebsd-3.3.rc [new file with mode: 0644]
contrib/iconv/iconv.glibc-2.1.3.rc [new file with mode: 0644]
contrib/iconv/iconv.glibc-2.1.90.rc [new file with mode: 0644]
contrib/iconv/iconv.hpux-10.01.rc [new file with mode: 0644]
contrib/iconv/iconv.hpux-10.20.rc [new file with mode: 0644]
contrib/iconv/iconv.hpux-11.00.rc [new file with mode: 0644]
contrib/iconv/iconv.irix-6.5.rc [new file with mode: 0644]
contrib/iconv/iconv.osf1-4.0a.rc [new file with mode: 0644]
contrib/iconv/iconv.osf1-4.0d.rc [new file with mode: 0644]
contrib/iconv/iconv.solaris-2.4.rc [new file with mode: 0644]
contrib/iconv/iconv.solaris-2.5.1.rc [new file with mode: 0644]
contrib/iconv/iconv.solaris-2.6-cjk.rc [new file with mode: 0644]
contrib/iconv/iconv.solaris-2.6.rc [new file with mode: 0644]
contrib/iconv/iconv.solaris-2.7.rc [new file with mode: 0644]
contrib/iconv/make.sh [new file with mode: 0755]
doc/Makefile.in
doc/instdoc.sh.in [new file with mode: 0644]
doc/manual.sgml.head
doc/muttrc.man.head
doc/muttrc.man.tail
hook.c
init.h
mutt.h
protos.h

index a91f23f11cc32d471228aa6f1462f4a824b00d28..7003eaebdb6c2966db852c22dfef7c16ff86b5e4 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -195,10 +195,11 @@ PreferredMIMENames[] =
   { "PCK",             "Shift_JIS"     },
   { "ko_KR-euc",       "euc-kr"        },
   { "zh_TW-big5",      "big5"          },
-  
-  
-  
-  
+
+  /* seems to be common on some systems */
+
+  { "sjis",            "Shift_JIS"     },
+
   
   /* End of aliases.  Please keep this line last. */
   
@@ -306,6 +307,8 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags)
   char fromcode1[SHORT_STRING];
   char *tmp;
 
+  iconv_t cd;
+  
   mutt_canonical_charset (tocode1, sizeof (tocode1), tocode);
   if ((flags & M_ICONV_HOOK_TO) && (tmp = mutt_charset_hook (tocode1)))
     mutt_canonical_charset (tocode1, sizeof (tocode1), tmp);
@@ -314,7 +317,10 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags)
   if ((flags & M_ICONV_HOOK_FROM) && (tmp = mutt_charset_hook (fromcode1)))
     mutt_canonical_charset (fromcode1, sizeof (fromcode1), tmp);
 
-  return iconv_open (tocode1, fromcode1);
+  if ((cd = iconv_open (tocode1, fromcode1)) != (iconv_t) -1)
+    return cd;
+  /* else */
+  return iconv_open (mutt_iconv_hook (tocode1), mutt_iconv_hook (fromcode1));
 }
 
 
index 238cb7c3506c9ea97056be8cb3ca06bf46154186..4b4402653c3910239734574c26d5da72faa8d123 100644 (file)
@@ -905,4 +905,5 @@ AC_OUTPUT(Makefile intl/Makefile m4/Makefile dnl
        po/Makefile.in doc/Makefile contrib/Makefile dnl
        muttbug.sh dnl
        imap/Makefile dnl
-       Muttrc.head)
+       Muttrc.head dnl
+       doc/instdoc.sh)
index 94b41635a7a523aba61255972e901d8aad9dbc65..2c339d3671631ea90de26b1674db0f10e2228a63 100644 (file)
@@ -28,6 +28,8 @@ DISTFILES= Makefile.in language.txt language50.txt  \
        patch.slang-1.2.2.keypad.1      \
        $(SAMPLES)
 
+ICONV_DISTFILES=README make.sh
+
 all clean:
 
 distclean:
@@ -36,10 +38,13 @@ distclean:
 check:
 
 install:
-       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/samples
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/samples $(DESTDIR)$(docdir)/samples/iconv
        for f in $(SAMPLES) ; do \
                $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir)/samples ;   \
        done
+       for f in $(srcdir)/iconv/*.rc ; do                                      \
+               $(INSTALL) -m 644 $$f $(DESTDIR)$(docdir)/samples/iconv   ;     \
+       done
 
 # Nothing needs to be done - uninstall in doc removes samples as well.
 # This is just so make uninstall doesn't fail.
@@ -57,4 +62,12 @@ dist distdir: Makefile $(DISTFILES)
                ln $(srcdir)/$$file $(distdir) 2> /dev/null     \
                        || cp -p $(srcdir)/$$file $(distdir);   \
        done
-                       
+       mkdir -p $(distdir)/iconv
+       for file in $(ICONV_DISTFILES) ; do
+               ln $(srcdir)/iconv/$$file $(distdir)/iconv 2> /dev/null         \
+                       || cp -p $(srcdir)/iconv/$$file $(distdir)/iconv;       \
+       done
+       for file in $(srcdir)/iconv/*.rc ; do
+               ln $$file $(distdir)/iconv 2> /dev/null                         \
+                       || cp -p $$file $(distdir)/iconv ;                      \
+       done
diff --git a/contrib/iconv/README b/contrib/iconv/README
new file mode 100644 (file)
index 0000000..1a3135c
--- /dev/null
@@ -0,0 +1,15 @@
+This directory contains sample collections of iconv-hooks for
+various platforms.  The files have been auto-generated from the
+source code of Bruno Haible's libiconv implementation, version 1.5.1.
+
+libiconv is available from <http://clisp.cons.org/~haible/packages-libiconv.html>.
+
+If you want to re-generate the files from a newer version of
+libiconv, just type:
+
+       rm -f *.rc
+       ./make.sh <top-level iconv directory>
+
+Note, however, that make.sh isn't guaranteed to run on any system
+but the one used for generating these files.
+
diff --git a/contrib/iconv/iconv.aix-3.2.5.rc b/contrib/iconv/iconv.aix-3.2.5.rc
new file mode 100644 (file)
index 0000000..45fe632
--- /dev/null
@@ -0,0 +1,2 @@
+iconv-hook CP850 IBM-850
+iconv-hook ISO-8859-1 ISO8859-1
diff --git a/contrib/iconv/iconv.aix-4.1.5.rc b/contrib/iconv/iconv.aix-4.1.5.rc
new file mode 100644 (file)
index 0000000..6481a25
--- /dev/null
@@ -0,0 +1,13 @@
+iconv-hook CP1046 IBM-1046
+iconv-hook CP850 IBM-850
+iconv-hook CP856 IBM-856
+iconv-hook CP932 IBM-932
+iconv-hook EUC-CN IBM-eucCN
+iconv-hook EUC-JP IBM-eucJP
+iconv-hook EUC-KR IBM-eucKR
+iconv-hook EUC-TW IBM-eucTW
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-6 ISO8859-6
+iconv-hook ISO-8859-8 ISO8859-8
diff --git a/contrib/iconv/iconv.aix-4.2.0.rc b/contrib/iconv/iconv.aix-4.2.0.rc
new file mode 100644 (file)
index 0000000..aeb5327
--- /dev/null
@@ -0,0 +1,18 @@
+iconv-hook BIG5 big5
+iconv-hook CP1046 IBM-1046
+iconv-hook CP850 IBM-850
+iconv-hook CP856 IBM-856
+iconv-hook CP922 IBM-922
+iconv-hook CP932 IBM-932
+iconv-hook EUC-CN IBM-eucCN
+iconv-hook EUC-JP IBM-eucJP
+iconv-hook EUC-KR IBM-eucKR
+iconv-hook EUC-TW IBM-eucTW
+iconv-hook ISO-8859-13 IBM-921
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-6 ISO8859-6
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-8 ISO8859-8
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.aix-4.3.2.rc b/contrib/iconv/iconv.aix-4.3.2.rc
new file mode 100644 (file)
index 0000000..f0aa365
--- /dev/null
@@ -0,0 +1,23 @@
+iconv-hook BIG5 big5
+iconv-hook CP1046 IBM-1046
+iconv-hook CP1124 IBM-1124
+iconv-hook CP1129 IBM-1129
+iconv-hook CP1252 IBM-1252
+iconv-hook CP850 IBM-850
+iconv-hook CP856 IBM-856
+iconv-hook CP922 IBM-922
+iconv-hook CP932 IBM-932
+iconv-hook CP943 IBM-943
+iconv-hook EUC-CN IBM-eucCN
+iconv-hook EUC-JP IBM-eucJP
+iconv-hook EUC-KR IBM-eucKR
+iconv-hook EUC-TW IBM-eucTW
+iconv-hook ISO-8859-13 IBM-921
+iconv-hook ISO-8859-15 ISO8859-15
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-6 ISO8859-6
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-8 ISO8859-8
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.freebsd-3.3.rc b/contrib/iconv/iconv.freebsd-3.3.rc
new file mode 100644 (file)
index 0000000..24e8bbb
--- /dev/null
@@ -0,0 +1,6 @@
+iconv-hook ASCII <error>
+iconv-hook CP866 <error>
+iconv-hook ISO-8859-15 <error>
+iconv-hook ISO-8859-1 <error>
+iconv-hook ISO-8859-2 <error>
+iconv-hook KOI8-R <error>
diff --git a/contrib/iconv/iconv.glibc-2.1.3.rc b/contrib/iconv/iconv.glibc-2.1.3.rc
new file mode 100644 (file)
index 0000000..4003291
--- /dev/null
@@ -0,0 +1 @@
+iconv-hook ISO-8859-1 ANSI_X3.4-1968
diff --git a/contrib/iconv/iconv.glibc-2.1.90.rc b/contrib/iconv/iconv.glibc-2.1.90.rc
new file mode 100644 (file)
index 0000000..3ba121e
--- /dev/null
@@ -0,0 +1 @@
+iconv-hook ASCII ANSI_X3.4-1968
diff --git a/contrib/iconv/iconv.hpux-10.01.rc b/contrib/iconv/iconv.hpux-10.01.rc
new file mode 100644 (file)
index 0000000..adf5e19
--- /dev/null
@@ -0,0 +1,15 @@
+iconv-hook EUC-CN hp15CN
+iconv-hook EUC-TW eucTW
+iconv-hook HP-ARABIC8 arabic8
+iconv-hook HP-GREEK8 greek8
+iconv-hook HP-HEBREW8 hebrew8
+iconv-hook HP-ROMAN8 roman8
+iconv-hook HP-TURKISH8 turkish8
+iconv-hook ISO-8859-1 iso88591
+iconv-hook ISO-8859-2 iso88592
+iconv-hook ISO-8859-5 iso88595
+iconv-hook ISO-8859-6 iso88596
+iconv-hook ISO-8859-7 iso88597
+iconv-hook ISO-8859-8 iso88598
+iconv-hook ISO-8859-9 iso88599
+iconv-hook TIS-620 tis620
diff --git a/contrib/iconv/iconv.hpux-10.20.rc b/contrib/iconv/iconv.hpux-10.20.rc
new file mode 100644 (file)
index 0000000..38bc1a1
--- /dev/null
@@ -0,0 +1,15 @@
+iconv-hook HP-ARABIC8 arabic8
+iconv-hook HP-GREEK8 greek8
+iconv-hook HP-HEBREW8 hebrew8
+iconv-hook HP-ROMAN8 roman8
+iconv-hook HP-TURKISH8 turkish8
+iconv-hook ISO-8859-15 iso885915
+iconv-hook ISO-8859-1 iso88591
+iconv-hook ISO-8859-2 iso88592
+iconv-hook ISO-8859-5 iso88595
+iconv-hook ISO-8859-6 iso88596
+iconv-hook ISO-8859-7 iso88597
+iconv-hook ISO-8859-8 iso88598
+iconv-hook ISO-8859-9 iso88599
+iconv-hook TIS-620 tis620
+iconv-hook UTF-8 utf8
diff --git a/contrib/iconv/iconv.hpux-11.00.rc b/contrib/iconv/iconv.hpux-11.00.rc
new file mode 100644 (file)
index 0000000..81bda2f
--- /dev/null
@@ -0,0 +1,21 @@
+iconv-hook BIG5 big5
+iconv-hook EUC-CN hp15CN
+iconv-hook EUC-JP eucJP
+iconv-hook EUC-KR eucKR
+iconv-hook EUC-TW eucTW
+iconv-hook HP-ARABIC8 arabic8
+iconv-hook HP-GREEK8 greek8
+iconv-hook HP-HEBREW8 hebrew8
+iconv-hook HP-KANA8 kana8
+iconv-hook HP-ROMAN8 roman8
+iconv-hook HP-TURKISH8 turkish8
+iconv-hook ISO-8859-15 iso885915
+iconv-hook ISO-8859-1 iso88591
+iconv-hook ISO-8859-2 iso88592
+iconv-hook ISO-8859-5 iso88595
+iconv-hook ISO-8859-6 iso88596
+iconv-hook ISO-8859-7 iso88597
+iconv-hook ISO-8859-8 iso88598
+iconv-hook ISO-8859-9 iso88599
+iconv-hook TIS-620 tis620
+iconv-hook UTF-8 utf8
diff --git a/contrib/iconv/iconv.irix-6.5.rc b/contrib/iconv/iconv.irix-6.5.rc
new file mode 100644 (file)
index 0000000..4cdba04
--- /dev/null
@@ -0,0 +1,9 @@
+iconv-hook EUC-CN eucCN
+iconv-hook EUC-JP eucJP
+iconv-hook EUC-KR eucKR
+iconv-hook EUC-TW eucTW
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.osf1-4.0a.rc b/contrib/iconv/iconv.osf1-4.0a.rc
new file mode 100644 (file)
index 0000000..3e4bbdd
--- /dev/null
@@ -0,0 +1,3 @@
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.osf1-4.0d.rc b/contrib/iconv/iconv.osf1-4.0d.rc
new file mode 100644 (file)
index 0000000..837b02f
--- /dev/null
@@ -0,0 +1,4 @@
+iconv-hook CP850 cp850
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.solaris-2.4.rc b/contrib/iconv/iconv.solaris-2.4.rc
new file mode 100644 (file)
index 0000000..7981bf0
--- /dev/null
@@ -0,0 +1 @@
+iconv-hook  bug
diff --git a/contrib/iconv/iconv.solaris-2.5.1.rc b/contrib/iconv/iconv.solaris-2.5.1.rc
new file mode 100644 (file)
index 0000000..673e46b
--- /dev/null
@@ -0,0 +1 @@
+iconv-hook ISO-8859-1 ISO8859-1
diff --git a/contrib/iconv/iconv.solaris-2.6-cjk.rc b/contrib/iconv/iconv.solaris-2.6-cjk.rc
new file mode 100644 (file)
index 0000000..d0cb0b2
--- /dev/null
@@ -0,0 +1,11 @@
+iconv-hook EUC-CN gb2312
+iconv-hook EUC-JP eucJP
+iconv-hook EUC-KR 5601
+iconv-hook EUC-TW cns11643
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-4 ISO8859-4
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-9 ISO8859-9
+iconv-hook Shift_JIS PCK
diff --git a/contrib/iconv/iconv.solaris-2.6.rc b/contrib/iconv/iconv.solaris-2.6.rc
new file mode 100644 (file)
index 0000000..8ecdb4d
--- /dev/null
@@ -0,0 +1,6 @@
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-4 ISO8859-4
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-9 ISO8859-9
diff --git a/contrib/iconv/iconv.solaris-2.7.rc b/contrib/iconv/iconv.solaris-2.7.rc
new file mode 100644 (file)
index 0000000..e4850b1
--- /dev/null
@@ -0,0 +1,12 @@
+iconv-hook ASCII 646
+iconv-hook ISO-8859-15 ISO8859-15
+iconv-hook ISO-8859-1 ISO8859-1
+iconv-hook ISO-8859-2 ISO8859-2
+iconv-hook ISO-8859-4 ISO8859-4
+iconv-hook ISO-8859-5 ISO8859-5
+iconv-hook ISO-8859-6 ISO8859-6
+iconv-hook ISO-8859-7 ISO8859-7
+iconv-hook ISO-8859-8 ISO8859-8
+iconv-hook ISO-8859-9 ISO8859-9
+iconv-hook KOI8-R koi8-r
+iconv-hook TIS-620 TIS620.2533
diff --git a/contrib/iconv/make.sh b/contrib/iconv/make.sh
new file mode 100755 (executable)
index 0000000..777d002
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh --
+
+#
+# Create sample configuration files from the tables contained with libiconv.
+# Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
+#
+# This ugly shell script is free software; you can distribute and/or modify
+# it under the terms of the GNU General Public License version 2 or later.
+#
+
+LIBICONV="$1"
+test -d $LIBICONV/libcharset/tools || {
+       echo "Sorry, I can't find libiconv's source!" >&2 ; 
+       exit 1 ;
+}
+
+for f in $LIBICONV/libcharset/tools/* ; do
+       rm -f tmp.rc.
+       ( head -3 $f | grep -q 'locale name.*locale charmap.*locale_charset' ) && (
+               sed '1,/^$/d' $f | awk '($4 != $3) { printf ("iconv-hook %s %s\n", $4, $3); }' | \
+                       sed -e 's/^iconv-hook SJIS /iconv-hook Shift_JIS /gi' |
+                       sort -u > tmp.rc )
+       test -s tmp.rc && mv tmp.rc iconv.`basename $f`.rc
+       rm -f tmp.rc
+done
index cec97cc79db60efcc01ec825d0e8ce224639b86f..1f0132f8b23ff422a7519455f2d939ac091a7026 100644 (file)
@@ -68,16 +68,16 @@ try-html: ../makedoc
 try-txt: ../makedoc
        test -f manual.txt || $(MAKE) manual.txt || cp $(srcdir)/manual.txt ./
 
-install: all
+install: all instdoc
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man5
-       $(INSTALL) -m 644 $(srcdir)/mutt.man $(DESTDIR)$(mandir)/man1/mutt.1
-       $(INSTALL) -m 644 $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/flea.1
+       ./instdoc $(srcdir)/mutt.man $(DESTDIR)$(mandir)/man1/mutt.1
+       ./instdoc $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/flea.1
        echo ".so $(mandir)/man1/flea.1" > $(DESTDIR)$(mandir)/man1/muttbug.1
-       $(INSTALL) -m 644 $(srcdir)/dotlock.man \
+       ./instdoc $(srcdir)/dotlock.man \
                $(DESTDIR)$(mandir)/man1/mutt_dotlock.1
-       $(INSTALL) -m 644 muttrc.man $(DESTDIR)$(mandir)/man5/muttrc.5
-       $(INSTALL) -m 644 $(srcdir)/mbox.man $(DESTDIR)$(mandir)/man5/mbox.5
+       ./instdoc muttrc.man $(DESTDIR)$(mandir)/man5/muttrc.5
+       ./instdoc $(srcdir)/mbox.man $(DESTDIR)$(mandir)/man5/mbox.5
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)
        for f in $(srcdir_DOCFILES) ; do \
                $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir) ; \
@@ -126,6 +126,10 @@ Makefile: Makefile.in ../config.status
        cd .. \
          && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+instdoc.sh: instdoc.sh.in ../config.status
+       cd .. \
+         && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir: Makefile $(DISTFILES)
        for file in $(DISTFILES) ; do                           \
diff --git a/doc/instdoc.sh.in b/doc/instdoc.sh.in
new file mode 100644 (file)
index 0000000..953d920
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh --
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libdir=@libdir@
+mandir=@mandir@
+sharedir=@sharedir@
+srcdir=@srcdir@
+docdir=@docdir@
+includedir=@includedir@
+top_srcdir=@top_srcdir@
+top_builddir=..
+
+SOURCE="$1"
+TARGET="$2"
+
+
+rm -f "$TARGET"
+
+sed -e "s;/usr/local/bin/;$bindir/;g"          \
+    -e "s;/usr/local/doc/mutt/;$docdir/;g"     \
+    "$SOURCE" > $TARGET
+
+chmod 644 "$TARGET"
index 635f16a4b602c9c89022ce5b5f9a3170d543c09a..bda7845184028b7b320d2cef3af404e829ba7032 100644 (file)
@@ -918,10 +918,17 @@ sequence.
 <sect1>Defining aliases for character sets <label id="charset-hook">
 <p>
 Usage: <tt/charset-hook/ <em/alias/ <em/charset/
+Usage: <tt/iconv-hook/ <em/charset/ <em/local-charset/
+
+The <tt/charset-hook/ command defines an alias for a character set.
+This is useful to properly display messages which are tagged with a
+character set name not known to mutt.
+
+The <tt/iconv-hook/ command defines a system-specific name for a
+character set.  This is helpful when your systems character
+conversion library insists on using strange, system-specific names
+for character sets.
 
-This command defines an alias for a character set.  This is useful
-to properly display messages which are tagged with a character set
-name not known to mutt.
 
 <sect1>Setting variables based upon mailbox<label id="folder-hook">
 <p>
index a3a17050550ea2e1d10c833d4e1913f5238327ba..26ba83658f907c760be4264e42a075923b5f3355 100644 (file)
@@ -111,6 +111,19 @@ This command defines an alias for a character set.  This is useful
 to properly display messages which are tagged with a character set
 name not known to mutt.
 .TP
+\fBiconv-hook\fP \fIcharset\fP \fIlocal-charset\fP
+This command defines a system-specific name for a character set.
+This is useful when your system's 
+.BR iconv (3)
+implementation does not understand MIME character set names (such as 
+.BR iso-8859-1 ),
+but instead insists on being fed with implementation-specific
+character set names (such as
+.BR 8859-1 ).
+In this specific case, you'd put this into your configuration file:
+.IP
+.B "iconv-hook iso-8859-1 8859-1"
+.TP
 \fBmessage-hook\fP [\fB!\fP]\fIpattern\fP \fIcommand\fP
 Before mutt displays (or formats for replying or forwarding) a
 message which matches the given \fIpattern\fP (or, when it is
index c87e78cc4a43dd34c2256bc94c56e042bb200ea7..1c780dff4cb56e9fd14bd79f32d95b6ff1067831 100644 (file)
@@ -1,6 +1,8 @@
 .\" -*-nroff-*-
 .SH SEE ALSO
 .PP
+.BR iconv (1),
+.BR iconv (3),
 .BR mailcap (5),
 .BR maildir (5),
 .BR mbox (5),
diff --git a/hook.c b/hook.c
index d895c466105479b151364efa5c61438eab6a59e3..8bf7b1fea34f4d6a907d53433bb4fbe001b4c46f 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -157,7 +157,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
 #ifdef M_PGPHOOK
     if ((rc = REGCOMP (rx, NONULL(pattern.data), ((data & (M_PGPHOOK|M_CHARSETHOOK)) ? REG_ICASE : 0))) != 0)
 #else
-    if ((rc = REGCOMP (rx, NONULL(pattern.data), (data & M_CHARSETHOOK) ? REG_ICASE : 0)) != 0)
+    if ((rc = REGCOMP (rx, NONULL(pattern.data), (data & (M_CHARSETHOOK|M_ICONVHOOK)) ? REG_ICASE : 0)) != 0)
 #endif /* HAVE_PGP */
     {
       regerror (rc, rx, err->data, err->dsize);
@@ -412,6 +412,11 @@ char *mutt_charset_hook (const char *chs)
   return _mutt_string_hook (chs, M_CHARSETHOOK);
 }
 
+char *mutt_iconv_hook (const char *chs)
+{
+  return _mutt_string_hook (chs, M_ICONVHOOK);
+}
+
 #ifdef HAVE_PGP
 char *mutt_pgp_hook (ADDRESS *adr)
 {
diff --git a/init.h b/init.h
index 3289b403e7704b7ad78b85d774330afbcb5742b5..324f8dcff4debb996cdd0b8d80f6fb9067191b1e 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2285,6 +2285,7 @@ struct command_t Commands[] = {
   { "fcc-save-hook",   mutt_parse_hook,        M_FCCHOOK | M_SAVEHOOK },
   { "folder-hook",     mutt_parse_hook,        M_FOLDERHOOK },
   { "hdr_order",       parse_list,             UL &HeaderOrderList },
+  { "iconv-hook",      mutt_parse_hook,        M_ICONVHOOK }, 
   { "ignore",          parse_ignore,           0 },
   { "lists",           parse_list,             UL &MailLists },
   { "macro",           mutt_parse_macro,       0 },
diff --git a/mutt.h b/mutt.h
index cde5ecd95f34ec73d194058cb37139f17c7b152e..908ffe1ce68b11f9dca21b565bc3ec87f04b33d8 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -137,9 +137,10 @@ typedef enum
 #define M_FCCHOOK      (1<<3)
 #define M_SAVEHOOK     (1<<4)
 #define M_CHARSETHOOK  (1<<5)
-#define M_MESSAGEHOOK  (1<<6)
+#define M_ICONVHOOK    (1<<6)
+#define M_MESSAGEHOOK  (1<<7)
 #ifdef HAVE_PGP
-#define M_PGPHOOK      (1<<7)
+#define M_PGPHOOK      (1<<8)
 #endif
 
 /* tree characters for linearize_tree and print_enriched_string */
index 1e0bbe793186c027ed05946cc85c7c6b065c3ccc..2c38809146f7ee3db221bc1223d55e95333f036f 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -121,6 +121,7 @@ const char *mutt_attach_fmt (
 
 
 char *mutt_charset_hook (const char *);
+char *mutt_iconv_hook (const char *);
 char *mutt_expand_path (char *, size_t);
 char *_mutt_expand_path (char *, size_t, int);
 char *mutt_find_hook (int, const char *);