From f712b85f8ccd3f9ada3fac2dda8f5ced66658c2a 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 273c09ecb..9ae76ca32 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2680,6 +2680,7 @@ int StrBufRFC2047encode(StrBuf **target, const StrBuf *source) (ch > 126) || (ch == 61) || (ch == '=') || + (ch == '_') || (ch == '[') || (ch == ']') ) { @@ -2687,7 +2688,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