aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-08-31 09:46:44 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-08-31 09:46:44 +0800
commitdbe98bddd36330aaca54af847593d05742da3840 (patch)
treea87450fba3d82f8717def85319bdc6e0e68727ba /camel
parentd4a67b5d3b738cbc61056f06ead766ce5cee2985 (diff)
downloadgsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar.gz
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar.bz2
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar.lz
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar.xz
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.tar.zst
gsoc2013-evolution-dbe98bddd36330aaca54af847593d05742da3840.zip
New function - even though its broken, we'll assume mailers send latin1
2000-08-31 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (append_latin1): New function - even though its broken, we'll assume mailers send latin1 headers instead of us-ascii. We just have to encode high chars into utf-8. (header_decode_text): Call append_latin1 for appending unencoded text segments. svn path=/trunk/; revision=5128
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/camel-mime-utils.c26
2 files changed, 32 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 012f305998..de5d145e77 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,11 @@
+2000-08-31 Not Zed <NotZed@HelixCode.com>
+
+ * camel-mime-utils.c (append_latin1): New function - even though
+ its broken, we'll assume mailers send latin1 headers instead of
+ us-ascii. We just have to encode high chars into utf-8.
+ (header_decode_text): Call append_latin1 for appending unencoded
+ text segments.
+
2000-08-30 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-store.c (camel_imap_fetch_command):
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 90d7496ce3..193d9d00c5 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -914,6 +914,28 @@ g_string_append_len(GString *st, const char *s, int l)
return g_string_append(st, tmp);
}
+/* ok, a lot of mailers are BROKEN, and send iso-latin1 encoded
+ headers, when they should just be sticking to US-ASCII
+ according to the rfc's. Anyway, since the conversion to utf-8
+ is trivial, just do it here without iconv */
+static GString *
+append_latin1(GString *out, const char *in, int len)
+{
+ unsigned int c;
+
+ while (len) {
+ c = (unsigned int)*in++;
+ len--;
+ if (c & 0x80) {
+ out = g_string_append_c(out, 0xc0 | (c>>6)); /* 110000xx */
+ out = g_string_append_c(out, 0x80 | (c&0x3f)); /* 10xxxxxx */
+ } else {
+ out = g_string_append_c(out, c);
+ }
+ }
+ return out;
+}
+
/* decodes a simple text, rfc822 */
static char *
header_decode_text(const char *in, int inlen)
@@ -934,11 +956,11 @@ header_decode_text(const char *in, int inlen)
out = g_string_append_len(out, decword, strlen(decword));
g_free (decword);
} else {
- out = g_string_append_len(out, inptr, encend-inptr+2);
+ out = append_latin1(out, inptr, encend-inptr+2);
}
inptr = encend+2;
}
- out = g_string_append_len(out, inptr, inend-inptr);
+ out = append_latin1(out, inptr, inend-inptr);
encstart = out->str;
g_string_free(out, FALSE);