From 911f9d2cef2464a83b73783260d1774285816351 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 20 Aug 2011 09:50:26 +0000 Subject: [PATCH] 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.?= --- libcitadel/lib/stringbuf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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++; } } -- 2.30.2