diff --git a/bindings/vapi/gmime-2.6.vapi b/bindings/vapi/gmime-2.6.vapi index 59c6909a..0bb1991e 100644 --- a/bindings/vapi/gmime-2.6.vapi +++ b/bindings/vapi/gmime-2.6.vapi @@ -1342,7 +1342,7 @@ namespace GMime { [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_locale_language")] public static unowned string locale_language (); [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_set_user_charsets")] - public static void set_user_charsets (out unowned string charsets); + public static void set_user_charsets ([CCode (array_length = false)] string[] charsets); [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_shutdown")] public static void shutdown (); [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_user_charsets")] diff --git a/src/engine/rfc822/rfc822.vala b/src/engine/rfc822/rfc822.vala index f6256719..b09376ad 100644 --- a/src/engine/rfc822/rfc822.vala +++ b/src/engine/rfc822/rfc822.vala @@ -14,6 +14,11 @@ public enum TextFormat { HTML } +// This has the effect of ensuring all non US-ASCII and non-ISO-8859-1 +// headers are always encoded as UTF-8. This should be fine because +// message bodies are also always sent as UTF-8. +private const string[] USER_CHARSETS = { "UTF-8" }; + private int init_count = 0; internal Regex? invalid_filename_character_re = null; @@ -21,9 +26,10 @@ internal Regex? invalid_filename_character_re = null; public void init() { if (init_count++ != 0) return; - + GMime.init(GMime.ENABLE_RFC2047_WORKAROUNDS); - + GMime.set_user_charsets(USER_CHARSETS); + try { invalid_filename_character_re = new Regex("[/\\0]"); } catch (RegexError e) {