RFC-2047 & encoded QP text

David Relson relson at osagesoftware.com
Sat Jul 26 14:29:24 CEST 2003


Matthias,

Here's the section of RFC-2047 discussing characters allowed:

    encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

    charset = token    ; see section 3

    encoding = token   ; see section 4

    token = 1*<Any CHAR except SPACE, CTLs, and especials>

    especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "
                <"> / "/" / "[" / "]" / "?" / "." / "="

    encoded-text = 1*<Any printable ASCII character other than "?"
                      or SPACE>
                   ; (but see "Use of encoded-words in message
                   ; headers", section 5)

So, the encoded-text can be anything except space and question mark.

When I first read the above, I thought the "especials" were not allowed in 
the text part and put them in lexer_v3.l's QP pattern.  Testing with my 
sample set of QP encoded Subject lines, I found lines with all the 
especials except "@", ";", "?".

Anyhow, I've changed the definition to match RFC-2047's encoded-text, i.e.:

QP  [^[:blank]\?]+

David





More information about the bogofilter-dev mailing list