aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-14 02:53:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-14 02:53:08 +0800
commitaabc9c14ea0e9dc152e1aee605eeaace2ba4d4f6 (patch)
tree86fc004ac681b0edd182d073fb8cce941835ece9 /camel
parent3209f94b02a3d153df60f83d9595d32348fa7ae6 (diff)
downloadgsoc2013-evolution-aabc9c14ea0e9dc152e1aee605eeaace2ba4d4f6.tar.gz
gsoc2013-evolution-aabc9c14ea0e9dc152e1aee605eeaace2ba4d4f6.tar.zst
gsoc2013-evolution-aabc9c14ea0e9dc152e1aee605eeaace2ba4d4f6.zip
Added a hack to convert charsets in the format iso8859-1 to iso-8859-1
2001-07-13 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (rfc2047_decode_word): Added a hack to convert charsets in the format iso8859-1 to iso-8859-1 because it seems to be more iconv friendly. It has been reported that on some systems, iconv doesn't know about iso8859-1 while it *does* know about iso-8859-1. See bug #4530. svn path=/trunk/; revision=11094
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog24
-rw-r--r--camel/camel-mime-utils.c44
2 files changed, 43 insertions, 25 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d1abaa0b19..88fab1eafc 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,14 +1,22 @@
+2001-07-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-utils.c (rfc2047_decode_word): Added a hack to
+ convert charsets in the format iso8859-1 to iso-8859-1 because it
+ seems to be more iconv friendly. It has been reported that on some
+ systems, iconv doesn't know about iso8859-1 while it *does* know
+ about iso-8859-1. See bug #4530.
+
2001-07-13 Peter Williams <peterw@ximian.com>
- * Makefile.am (install-exec-local): Let people install as non-root,
- but give them a bigass warning so they're not allowed to complain when
- it doesn't work right.
+ * Makefile.am (install-exec-local): Let people install as
+ non-root, but give them a bigass warning so they're not allowed to
+ complain when it doesn't work right.
- * camel-remote-store.c (sync_remote_folder): New function:
- hash table callback.
- (remote_disconnect): If cleanly disconnecting, sync our folders. Fixes
- deadlocks on exit (folders syncing after store disconnects) and also makes
- sense.
+ * camel-remote-store.c (sync_remote_folder): New function: hash
+ table callback.
+ (remote_disconnect): If cleanly disconnecting, sync our
+ folders. Fixes deadlocks on exit (folders syncing after store
+ disconnects) and also makes sense.
2001-07-13 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index f051c0d596..357c183f02 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -934,8 +934,9 @@ rfc2047_decode_word(const char *in, int len)
inlen = quoted_decode(inptr+2, tmplen, decword);
break;
case 'B': {
- int state=0;
- unsigned int save=0;
+ int state = 0;
+ unsigned int save = 0;
+
inlen = base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save);
/* if state != 0 then error? */
break;
@@ -945,29 +946,38 @@ rfc2047_decode_word(const char *in, int len)
return NULL;
}
d(printf("The encoded length = %d\n", inlen));
- if (inlen>0) {
+ if (inlen > 0) {
/* yuck, all this snot is to setup iconv! */
- tmplen = inptr-in-3;
- encname = alloca(tmplen+1);
- encname[tmplen]=0;
- memcpy(encname, in+2, tmplen);
-
+ tmplen = inptr - in - 3;
+ encname = alloca (tmplen + 2);
+
+ /* Hack to convert charsets like ISO8859-1 to iconv-friendly ISO-8859-1 */
+ if (!g_strncasecmp (in + 2, "iso", 3) && *(in + 5) != '-') {
+ memcpy (encname, in + 2, 3);
+ encname[3] = '-';
+ memcpy (encname + 4, in + 5, tmplen - 3);
+ tmplen++;
+ } else {
+ memcpy (encname, in + 2, tmplen);
+ }
+ encname[tmplen] = '\0';
+
inbuf = decword;
-
- outlen = inlen*6+16;
- outbase = alloca(outlen);
+
+ outlen = inlen * 6 + 16;
+ outbase = alloca (outlen);
outbuf = outbase;
-
+
/* TODO: Should this cache iconv converters? */
- ic = iconv_open("UTF-8", encname);
+ ic = iconv_open ("UTF-8", encname);
if (ic != (iconv_t)-1) {
- ret = iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
+ ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret>=0) {
- iconv(ic, NULL, 0, &outbuf, &outlen);
+ iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = 0;
- decoded = g_strdup(outbase);
+ decoded = g_strdup (outbase);
}
- iconv_close(ic);
+ iconv_close (ic);
} else {
w(g_warning("Cannot decode charset, header display may be corrupt: %s: %s",
encname, strerror(errno)));