aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-01-28 12:04:51 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-01-28 12:04:51 +0800
commit8644df4c44ea281d77f57d6981326a730871c360 (patch)
tree670cee9cb0e4da8bc8b889e0da3711fd73aedb97 /composer
parenta81077272f8a2525ee65bb921913511e622fa4f3 (diff)
downloadgsoc2013-evolution-8644df4c44ea281d77f57d6981326a730871c360.tar.gz
gsoc2013-evolution-8644df4c44ea281d77f57d6981326a730871c360.tar.zst
gsoc2013-evolution-8644df4c44ea281d77f57d6981326a730871c360.zip
If the subject or body components of the mailto url are not in UTF-8,
2003-01-27 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (e_msg_composer_new_from_url): If the subject or body components of the mailto url are not in UTF-8, convert them to UTF-8. svn path=/trunk/; revision=19662
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog4
-rw-r--r--composer/e-msg-composer.c25
2 files changed, 27 insertions, 2 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index a5ea71831a..360e6146e1 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,5 +1,9 @@
2003-01-27 Jeffrey Stedfast <fejj@ximian.com>
+ * e-msg-composer.c (e_msg_composer_new_from_url): If the subject
+ or body components of the mailto url are not in UTF-8, convert
+ them to UTF-8.
+
* e-msg-composer-attachment.c (update_mime_type): Fixed a #warning
by converting the filename into a uri before passing it into
gnome_vfs_get_mime_type() since that function really needs a uri.
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0d1573024c..eccab36641 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -3658,6 +3658,7 @@ e_msg_composer_new_from_url (const char *url_in)
EDestination **tov, **ccv, **bccv;
char *subject = NULL, *body = NULL;
const char *p, *header;
+ size_t nread, nwritten;
char *content;
int len, clen;
@@ -3704,10 +3705,30 @@ e_msg_composer_new_from_url (const char *url_in)
bcc = add_recipients (bcc, content, FALSE);
} else if (!strncasecmp (header, "subject", len)) {
g_free (subject);
- subject = g_strdup (content);
+ if (g_utf8_validate (content, -1, NULL)) {
+ subject = content;
+ content = NULL;
+ } else {
+ subject = g_locale_to_utf8 (content, clen, &nread,
+ &nwritten, NULL);
+ if (subject) {
+ subject = g_realloc (subject, nwritten + 1);
+ subject[nwritten] = '\0';
+ }
+ }
} else if (!strncasecmp (header, "body", len)) {
g_free (body);
- body = g_strdup (content);
+ if (g_utf8_validate (content, -1, NULL)) {
+ body = content;
+ content = NULL;
+ } else {
+ body = g_locale_to_utf8 (content, clen, &nread,
+ &nwritten, NULL);
+ if (body) {
+ body = g_realloc (body, nwritten + 1);
+ body[nwritten] = '\0';
+ }
+ }
} else if (!strncasecmp (header, "attach", len)) {
e_msg_composer_attachment_bar_attach (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), content);
} else {