From 3505969b3e7f1608557eab0fe84b0cab7252f4cb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 5 Nov 2007 22:40:46 +0000 Subject: [PATCH] Monotone-Parent: 6b88d1d42fb21659bd47fc0d1167769d8101775f Monotone-Revision: 633db895fe1d25a8339861d7d55a062abc56205f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-05T22:40:46 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ UI/MailPartViewers/UIxMailPartViewer.m | 24 ++++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ec3df5e6..4d157a775 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-11-05 Wolfgang Sourdeau + * UI/MailPartViewers/UIxMailPartViewer.m ([UIxMailPartViewer + -flatContentAsString]): simplified method now that we know + -[NSString stringWithData:usingEncodingNamed:] has a more robust + implementation. + * UI/MailerUI/UIxMailListView.m ([UIxMailListView -showToAddress]): the answer is cached. diff --git a/UI/MailPartViewers/UIxMailPartViewer.m b/UI/MailPartViewers/UIxMailPartViewer.m index ab4ace1c3..78a8fc8ed 100644 --- a/UI/MailPartViewers/UIxMailPartViewer.m +++ b/UI/MailPartViewers/UIxMailPartViewer.m @@ -176,27 +176,19 @@ { charset = [[bodyInfo objectForKey:@"parameterList"] objectForKey: @"charset"]; - charset = [charset lowercaseString]; - if (![charset length] - || [charset isEqualToString: @"us-ascii"]) + if ([charset length]) + charset = [charset lowercaseString]; + else + charset = @"us-ascii"; + s = [NSString stringWithData: content usingEncodingNamed: charset]; + if (![s length]) { + /* latin 1 is used as a 8bit fallback charset... but does this + encoding accept any byte from 0 to 255? */ s = [[NSString alloc] initWithData: content encoding: NSISOLatin1StringEncoding]; [s autorelease]; } - else - { - s = [NSString stringWithData: content - usingEncodingNamed: charset]; - if (![s length]) - { - /* latin 1 is used as a 8bit fallback charset... but does this - encoding accept any byte from 0 to 255? */ - s = [[NSString alloc] initWithData: content - encoding: NSISOLatin1StringEncoding]; - [s autorelease]; - } - } if (!s) {