From c540870b0c5653363a06cf17fab33b7ffff49e78 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 28 Sep 2000 22:12:23 +0000 Subject: Check to see if the body has 8bit chars, if so - set the 2000-09-28 Jeffrey Stedfast * e-msg-composer.c (build_message): Check to see if the body has 8bit chars, if so - set the Content-Transfer-Encoding to 8bit. Addresses Bugzilla bug #652. svn path=/trunk/; revision=5623 --- composer/ChangeLog | 6 ++++++ composer/e-msg-composer.c | 21 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 31f91a78dc..021797dd20 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2000-09-28 Jeffrey Stedfast + + * e-msg-composer.c (build_message): Check to see if the body has + 8bit chars, if so - set the Content-Transfer-Encoding to 8bit. + Addresses Bugzilla bug #652. + 2000-09-25 Dan Winship * e-msg-composer-hdrs.c (setup_headers): fix typo in tooltip. diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 6173070676..1d191c8e25 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -186,6 +186,18 @@ typedef enum { MSG_FORMAT_ALTERNATIVE, } MsgFormat; +static gboolean +is_8bit (guchar *text) +{ + guchar *c; + + for (c = text; *c; c++) + if (*c > (guchar) 127) + return TRUE; + + return FALSE; +} + /* This functions builds a CamelMimeMessage for the message that the user has composed in `composer'. */ static CamelMimeMessage * @@ -198,6 +210,7 @@ build_message (EMsgComposer *composer) CamelMultipart *body = NULL; CamelMimePart *part; gchar *from = NULL; + gboolean e8bit; char *html = NULL, *plain = NULL, *fmt = NULL; int i; @@ -234,6 +247,7 @@ build_message (EMsgComposer *composer) } plain = get_text (composer->persist_stream_interface, "text/plain"); + e8bit = is_8bit (plain); fmt = format_text (plain); g_free (plain); @@ -248,6 +262,9 @@ build_message (EMsgComposer *composer) part = camel_mime_part_new (); camel_mime_part_set_content (part, fmt, strlen (fmt), "text/plain"); + if (e8bit) + camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_8BIT); + g_free (fmt); camel_multipart_add_part (body, part); camel_object_unref (CAMEL_OBJECT (part)); @@ -274,7 +291,9 @@ build_message (EMsgComposer *composer) break; case MSG_FORMAT_PLAIN: camel_mime_part_set_content (part, fmt, strlen (fmt), "text/plain"); - g_free(fmt); + if (e8bit) + camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_8BIT); + g_free (fmt); break; } camel_multipart_add_part (multipart, part); -- cgit v1.2.3