The Annoyance Filter.pdf - Fourmilab
The Annoyance Filter.pdf - Fourmilab
The Annoyance Filter.pdf - Fourmilab
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
134 MAIL FOLDER ANNOYANCE-FILTER §159<br />
159. Just because we’re interested in the contents of this part, doesn’t necessarily mean we can<br />
comprehend it. First of all, it must be encoded in a form we can either read directly or have a decoder<br />
for, and secondly it must be in a character set we understand, not some Asian chicken tracks. First of<br />
all, test the character set and accept only those we read directly or have interpreters for.<br />
〈 Test for multiple byte character sets and activate decoder if available 159 〉 ≡<br />
bool gibberish = false ;<br />
if (mimeContentTypeCharset .substr (0, 6) ≡ "gb2312") {<br />
mbd euc.setMailFolder (this);<br />
mbi gb2312 .setDecoder (mbd euc);<br />
mbi = &mbi gb2312 ;<br />
}<br />
if (mimeContentTypeCharset ≡ "big5") {<br />
mbd big5 .setMailFolder (this);<br />
mbi big5 .setDecoder (mbd big5 );<br />
mbi = &mbi big5 ;<br />
}<br />
if (mimeContentTypeCharset ≡ "utf−8") {<br />
mbd utf 8 .setMailFolder (this);<br />
mbi unicode .setDecoder (mbd utf 8 );<br />
mbi = &mbi unicode ;<br />
}<br />
if (mimeContentTypeCharset ≡ "euc−kr") {<br />
mbd euc.setMailFolder (this);<br />
mbi kr .setDecoder (mbd euc);<br />
mbi = &mbi kr ;<br />
}<br />
#ifdef CHECK_FOR_GIBBERISH_CHARACTER_SETS<br />
if ((mimeContentTypeCharset .length ( ) ≡ 0) ∨ (mimeContentTypeCharset ≡<br />
"us−ascii") ∨ (mimeContentTypeCharset .substr (0,<br />
8) ≡ "iso−8859") ∨ (mimeContentTypeCharset ≡ "windows−1251")) {<br />
if (Annotate (’d’)) {<br />
ostringstream os ;<br />
os ≪ "Accepting␣part␣in␣Content−Type−Charset:␣" ≪ mimeContentTypeCharset ≪<br />
"␣␣(" ≪ mimeContentType ≪ "␣" ≪ mimeContentTransferEncoding ≪ ")";<br />
reportParserDiagnostic(os );<br />
}<br />
}<br />
else {<br />
if (Annotate (’d’)) {<br />
ostringstream os ;<br />
}<br />
#endif<br />
os ≪ "Rejecting␣part␣in␣Content−Type−Charset:␣" ≪ mimeContentTypeCharset ≪<br />
"␣␣(" ≪ mimeContentType ≪ "␣" ≪ mimeContentTransferEncoding ≪ ")";<br />
reportParserDiagnostic(os );<br />
}<br />
gibberish = true ;<br />
This code is used in section 158.