X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=charset.c;h=08c4b0f6a230628b955beb687851f842791841be;hp=ba6b4227b61d68877be5298655917a9d7d99d560;hb=10e80e482eff3762b0b8d41b0c7795b76704479c;hpb=a8aba140a61d5b86093cea46afcb613092d4978d diff --git a/charset.c b/charset.c index ba6b422..08c4b0f 100644 --- 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 : '?'; +}