From 78c33575241d6acfd0b215d18b4bdd81841b3fca Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 26 Nov 2007 14:24:32 +0000 Subject: [PATCH] Monotone-Parent: 1e0cd0c819f1c4c90f09af9a26fb932910568542 Monotone-Revision: 6de7608d4605876bb174df7847a81f7e1cfb7c04 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-26T14:24:32 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 11 +++++++ UI/MailPartViewers/UIxMailPartICalViewer.m | 18 ---------- UI/MailPartViewers/UIxMailPartViewer.m | 38 ++++++++++------------ 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index a227c4e46..26387fc00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-11-26 Wolfgang Sourdeau + + * UI/MailPartViewers/UIxMailPartViewer.m + ([-fallbackStringEncoding]): removed method. + ([UIxMailPartViewer -flatContentAsString]): we no longer use [self + fallbackStringEncoding]. Instead we directly specify + NSISOLatin1StringEncoding if UTF-8 has failed. + + * UI/MailPartViewers/UIxMailPartICalViewer.m + ([-fallbackStringEncoding]): removed method. + 2007-11-25 Ludovic Marcotte * SoObjects/Mailer/SOGoMailForward.m diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index b30a88174..3ee2c8f61 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -76,24 +76,6 @@ [item release]; item = nil; } -/* raw content handling */ - -- (NSStringEncoding) fallbackStringEncoding -{ - /* - iCalendar invitations sent by Outlook 2002 have the annoying bug that the - mail states an UTF-8 content encoding but the actual iCalendar content is - encoding in Latin-1 (or Windows Western?). - - As a result the content decoding will fail (TODO: always?). In this case we - try to decode with Latin-1. - - Note: we could check for the Outlook x-mailer, but it was considered better - to try Latin-1 as a fallback in any case (be tolerant). - */ - return NSISOLatin1StringEncoding; -} - /* accessors */ - (iCalCalendar *) inCalendar diff --git a/UI/MailPartViewers/UIxMailPartViewer.m b/UI/MailPartViewers/UIxMailPartViewer.m index 2a4827d04..f3a44db78 100644 --- a/UI/MailPartViewers/UIxMailPartViewer.m +++ b/UI/MailPartViewers/UIxMailPartViewer.m @@ -159,11 +159,6 @@ return content; } -- (NSStringEncoding) fallbackStringEncoding -{ - return 0; -} - - (NSString *) flatContentAsString { /* Note: we even have the line count in the body-info! */ @@ -191,23 +186,24 @@ if (!s) { - /* - Note: this can happend with iCalendar invitations sent by Outlook 2002. - It will mark the content as UTF-8 but actually deliver it as - Latin-1 (or Windows encoding?). + /* + iCalendar invitations sent by Outlook 2002 have the annoying bug that the + mail states an UTF-8 content encoding but the actual iCalendar content is + encoding in Latin-1 (or Windows Western?). + + As a result the content decoding will fail (TODO: always?). In this case we + try to decode with Latin-1. + + Note: we could check for the Outlook x-mailer, but it was considered better + to try Latin-1 as a fallback in any case (be tolerant). */ - [self errorWithFormat:@"could not convert content to text, charset: '%@'", - charset]; - if ([self fallbackStringEncoding] > 0) - { - s = [[NSString alloc] initWithData:content - encoding: [self fallbackStringEncoding]]; - if (s) - [s autorelease]; - else - [self errorWithFormat: - @"an attempt to use fallback encoding failed to."]; - } + + s = [[NSString alloc] initWithData:content + encoding: NSISOLatin1StringEncoding]; + if (!s) + [self errorWithFormat: @"an attempt to use" + @" NSISOLatin1StringEncoding as callback failed"]; + [s autorelease]; } } else