aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-utils.c25
2 files changed, 19 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a6df9552a8..37ba9b0de7 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-10-06 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * camel-mime-utils.c (quoted_encode): Fix so that we don't encode
+ every single char in the word. Also, do we need a safemask? I
+ don't see why we would.
+
2000-10-06 Chris Toshok <toshok@helixcode.com>
* providers/nntp/Makefile.am (libcamelnntpinclude_HEADERS): add
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index d8f10672ac..3ddc8abf74 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -789,6 +789,7 @@ quoted_decode(const unsigned char *in, int len, unsigned char *out)
/* rfc2047 version of quoted-printable */
/* safemask is the mask to apply to the camel_mime_special_table to determine what
characters can safely be included without encoding */
+/* Why do we need a 'safemask'? we always want to encode the same. */
static int
quoted_encode(const unsigned char *in, int len, unsigned char *out, unsigned short safemask)
{
@@ -797,25 +798,25 @@ quoted_encode(const unsigned char *in, int len, unsigned char *out, unsigned sho
unsigned char c;
inptr = in;
- inend = in+len;
+ inend = in + len;
outptr = out;
- while (inptr<inend) {
+ while (inptr < inend) {
c = *inptr++;
- /*if (is_qpsafe(c) && !(c=='_' || c=='?')) {*/
- if (camel_mime_special_table[c] & safemask) {
- if (c==' ')
- c='_';
- *outptr++=c;
+ if ((is_qpsafe (c) || c == ' ') && !(c == '_' || c == '?')) {
+ /*if (camel_mime_special_table[c] & safemask) {*/
+ if (c == ' ')
+ c = '_';
+ *outptr++ = c;
} else {
*outptr++ = '=';
- *outptr++ = tohex[(c>>4) & 0xf];
+ *outptr++ = tohex[(c >> 4) & 0xf];
*outptr++ = tohex[c & 0xf];
}
}
- printf("encoding '%.*s' = '%.*s'\n", len, in, outptr-out, out);
+ d(printf("encoding '%.*s' = '%.*s'\n", len, in, outptr-out, out));
- return outptr-out;
+ return (outptr - out);
}
@@ -1177,9 +1178,9 @@ header_encode_string(const unsigned char *in)
}
start = inptr;
encoding = 0;
- } else if (c>127 && c < 256) {
+ } else if (c > 127 && c < 256) {
encoding = MAX(encoding, 1);
- } else if (c >=256) {
+ } else if (c >= 256) {
encoding = MAX(encoding, 2);
}
}