Updated the html2html filter. When we encounter a charset
[citadel.git] / 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");
+               }
+
        }
 }