(fix) EAS fix for wrong charset being used (#3392)

pull/101/head^2
Ludovic Marcotte 2015-11-23 18:07:50 -05:00
parent 888db0b1be
commit 9a12fb24a6
2 changed files with 32 additions and 5 deletions

View File

@ -472,6 +472,32 @@ struct GlobalObjectId {
return d; return d;
} }
//
//
//
- (BOOL) _sanitinizeNeeded: (NSArray *) theParts
{
NSString *encoding, *charset;
int i;
for (i = 0; i < [theParts count]; i++)
{
encoding = [[theParts objectAtIndex: i ] objectForKey: @"encoding"];
charset = [[[theParts objectAtIndex: i ] objectForKey: @"parameterList"] objectForKey: @"charset"];
if (encoding && [encoding caseInsensitiveCompare: @"8bit"] == NSOrderedSame &&
charset && ![charset caseInsensitiveCompare: @"utf-8"] == NSOrderedSame
&& ![charset caseInsensitiveCompare: @"us-ascii"] == NSOrderedSame)
{
return YES;
}
if ([self _sanitinizeNeeded: [[theParts objectAtIndex: i ] objectForKey: @"parts"]])
return YES;
}
return NO;
}
// //
// //
// //
@ -481,7 +507,7 @@ struct GlobalObjectId {
{ {
NSString *type, *subtype, *encoding; NSString *type, *subtype, *encoding;
NSData *d; NSData *d;
BOOL isSMIME; BOOL isSMIME, sanitinizeNeeded;
type = [[[self bodyStructure] valueForKey: @"type"] lowercaseString]; type = [[[self bodyStructure] valueForKey: @"type"] lowercaseString];
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString]; subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
@ -546,10 +572,10 @@ struct GlobalObjectId {
} }
else if (theType == 4 || isSMIME) else if (theType == 4 || isSMIME)
{ {
// We sanitize the content *ONLY* for Outlook clients and if the content-transfer-encoding is 8bit. Outlook has strange issues // We sanitize the content if the content-transfer-encoding is 8bit and charset is not utf-8 or us-ascii.
// with quoted-printable/base64 encoded text parts. It just doesn't decode them. sanitinizeNeeded = [self _sanitinizeNeeded: [NSArray arrayWithObject: [self bodyStructure]]];
encoding = [[self lookupInfoForBodyPart: @""] objectForKey: @"encoding"];
if ((encoding && ([encoding caseInsensitiveCompare: @"8bit"] == NSOrderedSame)) && !isSMIME) if (sanitinizeNeeded && !isSMIME)
d = [self _sanitizedMIMEMessage]; d = [self _sanitizedMIMEMessage];
else else
d = [self content]; d = [self content];

1
NEWS
View File

@ -10,6 +10,7 @@ Enhancements
Bug fixes Bug fixes
- JavaScript exception when printing events from calendars with no assigned color (#3203) - JavaScript exception when printing events from calendars with no assigned color (#3203)
- EAS fix for wrong charset being used (#3392)
2.3.3a (2015-11-18) 2.3.3a (2015-11-18)
------------------- -------------------