rolkey / indyproject

Automatically exported from code.google.com/p/indyproject
0 stars 0 forks source link

Content-Transfer-Encoding descrepency in TIdMessageCoderMIME.ReadBody() #300

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
RFC 2045 Section 6.1 states:

    "'Content-Transfer-Encoding: 7BIT' is assumed if the Content-Transfer-Encoding header field is not present."

However, RFC 2045 Section 6.4 states:

    "Any entity with an unrecognized Content-Transfer-Encoding must be treated as if it has a Content-Type of 'application/octet-stream', regardless of what the Content-Type header field actually says."

ReadBody() applies 6.1 before 6.4.  So, for example, if a Content-Type is 
"application/octet-stream" and a "Content-Transfer-Encoding" is not present, 
ReadBody() assumes 7bit per 6.1 and ignored 6.4 as 7bit is not unrecognized.  
This causes decoding problems, including non-ASCII bytes being converted to 
$3F, and an extra CRLF being inserted at the end of the decoded data.

If the data were processed as 8bit instead, it would be decoded as binary data 
and output correct bytes, as expected.

Original issue reported on code.google.com by gambit47 on 2 Dec 2014 at 10:03