From 26b7d1f342e19ed828c4d3a3b99b15987fddeb94 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 13 Oct 2010 16:28:43 +0200 Subject: Bug #630375 - Character encoding of GPG encrypted message not honored --- em-format/em-format.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'em-format') diff --git a/em-format/em-format.c b/em-format/em-format.c index 9574530109..dc20ac596d 100644 --- a/em-format/em-format.c +++ b/em-format/em-format.c @@ -1487,6 +1487,22 @@ add_validity_found (EMFormat *emf, /* ********************************************************************** */ +static void +preserve_charset_in_content_type (CamelMimePart *ipart, CamelMimePart *opart) +{ + CamelContentType *ict; + + g_return_if_fail (ipart != NULL); + g_return_if_fail (opart != NULL); + + ict = camel_data_wrapper_get_mime_type_field (camel_medium_get_content (CAMEL_MEDIUM (ipart))); + if (!ict || !camel_content_type_param (ict, "charset") || !*camel_content_type_param (ict, "charset")) + return; + + camel_content_type_set_param (camel_data_wrapper_get_mime_type_field (camel_medium_get_content (CAMEL_MEDIUM (opart))), + "charset", camel_content_type_param (ict, "charset")); +} + #ifdef ENABLE_SMIME static void emf_application_xpkcs7mime (EMFormat *emf, @@ -1521,6 +1537,7 @@ emf_application_xpkcs7mime (EMFormat *emf, opart = camel_mime_part_new (); valid = camel_cipher_context_decrypt_sync ( context, part, opart, cancellable, &local_error); + preserve_charset_in_content_type (part, opart); if (valid == NULL) { em_format_format_error ( emf, stream, "%s", @@ -1733,6 +1750,7 @@ emf_multipart_encrypted (EMFormat *emf, opart = camel_mime_part_new (); valid = camel_cipher_context_decrypt_sync ( context, part, opart, cancellable, &local_error); + preserve_charset_in_content_type (part, opart); if (valid == NULL) { em_format_format_error ( emf, stream, local_error->message ? @@ -2233,6 +2251,7 @@ emf_inlinepgp_encrypted (EMFormat *emf, camel_data_wrapper_set_mime_type (dw, snoop); } + preserve_charset_in_content_type (ipart, opart); g_free (mime_type); add_validity_found (emf, valid); -- cgit v1.2.3