mirror of https://github.com/adamdruppe/arsd.git
some improvements to emails.d decoders (after testing against 100.000+ emails)
This commit is contained in:
parent
ac1c5408dd
commit
576eb15638
9
email.d
9
email.d
|
@ -815,6 +815,13 @@ string decodeEncodedWord(string data) {
|
||||||
data = data[questionMark + 2 .. $];
|
data = data[questionMark + 2 .. $];
|
||||||
|
|
||||||
delimiter = data.indexOf("=?");
|
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;
|
immutable(ubyte)[] decodedText;
|
||||||
if(encoding == "Q")
|
if(encoding == "Q")
|
||||||
|
@ -843,6 +850,8 @@ immutable(ubyte)[] decodeQuotedPrintable(string text) {
|
||||||
if(b == '=') {
|
if(b == '=') {
|
||||||
state++;
|
state++;
|
||||||
hexByte = 0;
|
hexByte = 0;
|
||||||
|
} else if (b == '_') { // RFC2047 4.2.2: a _ may be used to represent a space
|
||||||
|
ret ~= ' ';
|
||||||
} else
|
} else
|
||||||
ret ~= b;
|
ret ~= b;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue