not having wide chars is soooo 90, please, I *really* don't care with
[apps/madmutt.git] / charset.c
index ba6b422..08c4b0f 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -35,6 +35,8 @@
 # define EILSEQ EINVAL
 #endif
 
+int Charset_is_utf8 = 0;
+
 /* 
  * The following list has been created manually from the data under:
  * http://www.isi.edu/in-notes/iana/assignments/character-sets
@@ -612,3 +614,23 @@ int mutt_convert_nonmime_string (char **ps)
   }
   return -1;
 }
+
+void mutt_set_charset (char *charset)
+{
+    char buffer[STRING];
+
+    mutt_canonical_charset (buffer, sizeof (buffer), charset);
+
+    Charset_is_utf8 = 0;
+    if (!strcmp (buffer, "utf-8"))
+        Charset_is_utf8 = 1;
+
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+    bind_textdomain_codeset (PACKAGE, buffer);
+#endif
+}
+
+wchar_t replacement_char (void)
+{
+    return Charset_is_utf8 ? 0xfffd : '?';
+}