Fixed text/plain reencoding issues for Outlook

pull/41/head
Ludovic Marcotte 2014-06-04 15:56:22 -04:00
parent ba258ca806
commit 72bec939d6
2 changed files with 19 additions and 7 deletions

View File

@ -285,20 +285,31 @@ struct GlobalObjectId {
[self _sanitizedMIMEPart: body
performed: b];
}
else if ([body isKindOfClass: [NSData class]] &&
else if (([body isKindOfClass: [NSData class]] || [body isKindOfClass: [NSString class]]) &&
[[[thePart contentType] type] isEqualToString: @"text"] &&
([[[thePart contentType] subType] isEqualToString: @"plain"] || [[[thePart contentType] subType] isEqualToString: @"html"]))
{
// We make sure everything is encoded in UTF-8
NSString *charset, *s;
NGMimeType *mimeType;
int encoding;
NSString *s;
charset = [[thePart contentType] valueOfParameter: @"charset"];
encoding = [NGMimeType stringEncodingForCharset: charset];
if ([body isKindOfClass: [NSData class]])
{
NSString *charset;
int encoding;
s = [[NSString alloc] initWithData: body encoding: encoding];
AUTORELEASE(s);
charset = [[thePart contentType] valueOfParameter: @"charset"];
encoding = [NGMimeType stringEncodingForCharset: charset];
s = [[NSString alloc] initWithData: body encoding: encoding];
AUTORELEASE(s);
}
else
{
// Handle situations when SOPE stupidly returns us a NSString
// This can happen for Content-Type: text/plain, Content-Transfer-Encoding: 8bit
s = body;
}
if (s)
{

1
NEWS
View File

@ -9,6 +9,7 @@ Bug fixes
- avoid crashing when we forward an email with no Subject header
- we no longer try to include attachments when replying to a mail
- fixed ActiveSync repetitive events issues with "Weekly" and "Monthly" ones
- fixed ActiveSync text/plain parts re-encoding issues for Outlook
2.2.4 (2014-05-29)
------------------