Updated the html2html filter. When we encounter a charset
authorArt Cancro <ajc@citadel.org>
Sat, 24 Feb 2007 04:58:54 +0000 (04:58 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 24 Feb 2007 04:58:54 +0000 (04:58 +0000)
declaration within the meta tags, the charset 'unicode' is manually aliased
to 'UTF-8'.  GNU iconv wants to treat it as an alias for 'UTF-16' but
messages generated by brain-damaged MS Exchange webmail are declaring
'unicode' when they really mean 'UTF-8'.  This change only applies to
meta tags; it is not a program-wide alias.

webcit/html2html.c

index 8799aaa2a3d6a2d85a61b511ebc7b7927338abc0..35fffd5d2bafc26302274fb967601217d8b2de30 100644 (file)
@@ -59,6 +59,18 @@ void extract_charset_from_meta(char *charset, char *meta_http_equiv, char *meta_
        striplt(buf);
        if (!strncasecmp(buf, "charset=", 8)) {
                strcpy(charset, &buf[8]);
+
+               /*
+                * The brain-damaged webmail program in Microsoft Exchange declares
+                * a charset of "unicode" when they really mean "UTF-8".  GNU iconv
+                * treats "unicode" as an alias for "UTF-16" so we have to manually
+                * fix this here, otherwise messages generated in Exchange webmail
+                * show up as a big pile of weird characters.
+                */
+               if (!strcasecmp(charset, "unicode")) {
+                       strcpy(charset, "UTF-8");
+               }
+
        }
 }