From: Wilfried Goesgens Date: Sat, 20 Aug 2011 09:50:26 +0000 (+0000) Subject: When QP encoding, we need to convert blanks to underscores X-Git-Tag: v8.11~1010 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=911f9d2cef2464a83b73783260d1774285816351 When QP encoding, we need to convert blanks to underscores - Spamassasin test 'BAD_ENC_HEADER' matches if a subject looks like that: Subject: =?UTF-8?Q?=5Btestml=5D l=C3=B6sch misch ey.?= it needs to look like that: Subject: =?UTF-8?Q?=5Btestml=5D_l=C3=B6sch_misch_ey.?= --- diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index f49ceb4cd..cfe42730c 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2664,6 +2664,7 @@ int StrBufRFC2047encode(StrBuf **target, const StrBuf *source) (ch > 126) || (ch == 61) || (ch == '=') || + (ch == '_') || (ch == '[') || (ch == ']') ) { @@ -2671,7 +2672,10 @@ int StrBufRFC2047encode(StrBuf **target, const StrBuf *source) (*target)->BufUsed += 3; } else { - (*target)->buf[(*target)->BufUsed] = ch; + if (ch == ' ') + (*target)->buf[(*target)->BufUsed] = '_'; + else + (*target)->buf[(*target)->BufUsed] = ch; (*target)->BufUsed++; } }