From 47a6a63e35d67cd8f61aea9f7cd8b7930e5076f0 Mon Sep 17 00:00:00 2001 From: "Alexander G.M. Smith" Date: Sun, 16 Oct 2005 18:33:20 +0000 Subject: [PATCH] Need to convert text/html to UTF-8 too, not just text/plain. So that the spam classifier can handle those Russian HTML only spam messages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14395 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/MailComponent.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/kits/mail/MailComponent.cpp b/src/kits/mail/MailComponent.cpp index 8841dd0a5d..4363b8d343 100644 --- a/src/kits/mail/MailComponent.cpp +++ b/src/kits/mail/MailComponent.cpp @@ -437,10 +437,19 @@ status_t BTextMailComponent::GetDecodedData(BPositionIO *data) { return B_IO_ERROR; BMimeType type; + BMimeType textAny ("text"); ssize_t written; - if (MIMEType(&type) == B_OK && type == "text/plain") + if (MIMEType(&type) == B_OK && textAny.Contains (&type)) + // Write out the string which has been both decoded from quoted + // printable or base64 etc, and then converted to UTF-8 from whatever + // character set the message specified. Do it for text/html, + // text/plain and all other text datatypes. Of course, if the message + // is HTML and specifies a META tag for a character set, it will now be + // wrong. But then we don't display HTML in BeMail, yet. written = data->Write(text.String(),text.Length()); else + // Just write out whatever the binary contents are, only decoded from + // the quoted printable etc format. written = data->Write(decoded.String(), decoded.Length()); return written >= 0 ? B_OK : written;