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.
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");
+ }
+
}
}