Skip to content

Commit

Permalink
some improvements to emails.d decoders (after testing against 100.000…
Browse files Browse the repository at this point in the history
…+ emails)
  • Loading branch information
Juanjo Alvarez committed Jun 17, 2014
1 parent ac1c540 commit 576eb15
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions email.d
Expand Up @@ -815,6 +815,13 @@ string decodeEncodedWord(string data) {
data = data[questionMark + 2 .. $];

delimiter = data.indexOf("=?");
if (delimiter == 1 && data[0] == ' ') {
// a single space between encoded words must be ignored because it is
// used to separate multiple encoded words (RFC2047 says CRLF SPACE but a most clients
// just use a space)
data = data[1..$];
delimiter = 0;
}

immutable(ubyte)[] decodedText;
if(encoding == "Q")
Expand Down Expand Up @@ -843,6 +850,8 @@ immutable(ubyte)[] decodeQuotedPrintable(string text) {
if(b == '=') {
state++;
hexByte = 0;
} else if (b == '_') { // RFC2047 4.2.2: a _ may be used to represent a space
ret ~= ' ';
} else
ret ~= b;
break;
Expand Down

0 comments on commit 576eb15

Please sign in to comment.