* Macros we use for parsing headers
*/
-#define is_fws(c) (c == '\t' || c == ' ')
+#define is_fws(c) (c == '\t' || c == ' ' || c == '\n')
#define qpspecial(c) (c < ' ' || c == '=' || c == '?' || c == '_')
*
*/
+ int tokenlen;
+
outlen += 9 + charsetlen + ascii + 3 * encoded;
/*
*q++ = *p++;
}
- q += snprintf(q, outlen - (q - output), "=?%s?Q?", charset);
- column = prefixlen;
+ tokenlen = snprintf(q, outlen - (q - output), "=?%s?Q?", charset);
+ q += tokenlen;
+ column = prefixlen + tokenlen;
newline = 0;
}
} else {
snprintf(q, outlen - (q - output), "=%02X", *((unsigned char *) p));
q += 3;
- column += 3;
+ column += 2; /* column already incremented by 1 above */
encoded--;
}