See ChangeLog

Monotone-Parent: 58575b53d5a371c107121b592dfc764b7917d986
Monotone-Revision: 35156d431d203984a125b3638bbea9d7877ed199

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2009-09-21T17:27:41
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2009-09-21 17:27:41 +00:00
parent 416b520fdf
commit 819c3bcab4
2 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2009-09-21 Ludovic Marcotte <lmarcotte@inverse.ca>
* SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m
Avoid lameness when handling QP-encoded content.
2009-09-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/MailerUI.js (updateMailboxTreeInPage):

View File

@ -31,6 +31,7 @@
#import "VSSaxDriver.h"
#import <SaxObjC/SaxException.h>
#import <NGExtensions/NGQuotedPrintableCoding.h>
#import <NGExtensions/NSString+Encoding.h>
#import <NGCards/NSString+NGCards.h>
#import "common.h"
@ -860,8 +861,25 @@ static NSCharacterSet *whitespaceCharSet = nil;
// TODO: make the encoding check more generic
if ([tagAttributes containsObject: @"ENCODING=QUOTED-PRINTABLE"])
{
// TODO: QP is charset specific! The one below decodes in Unicode!
tagValue = [tagValue stringByDecodingQuotedPrintable];
NSString *charset;
NSData *d;
int i;
d = [[tagValue dataUsingEncoding: NSASCIIStringEncoding]
dataByDecodingQuotedPrintable];
// Let's find the charset.
charset = @"utf-8";
for (i = 0; i < [tagAttributes count]; i++)
{
charset = [[tagAttributes objectAtIndex: i] lowercaseString];
if ([charset hasPrefix: @"charset"])
charset = [charset substringFromIndex: 8];
}
tagValue = [NSString stringWithData: d usingEncodingNamed: charset];
[tagAttributes removeObject: @"ENCODING=QUOTED-PRINTABLE"];
}