diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index 90a85f8ef..eb7df2a86 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -92,6 +92,7 @@ Mailer_RESOURCE_FILES += \ ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/ +ADDITIONAL_INCLUDE_DIRS += $(shell xml2-config --cflags) ADDITIONAL_LIB_DIRS += -L../../SOPE/GDLContentStore/obj/ -include GNUmakefile.preamble diff --git a/SoObjects/Mailer/NSString+Mail.h b/SoObjects/Mailer/NSString+Mail.h index c99b6b57c..e967622b5 100644 --- a/SoObjects/Mailer/NSString+Mail.h +++ b/SoObjects/Mailer/NSString+Mail.h @@ -1,8 +1,6 @@ /* NSString+Mail.h - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-2013 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Mailer/NSString+Mail.m b/SoObjects/Mailer/NSString+Mail.m index d9f9cc5f1..94f8e9b4f 100644 --- a/SoObjects/Mailer/NSString+Mail.m +++ b/SoObjects/Mailer/NSString+Mail.m @@ -1,8 +1,6 @@ /* NSString+Mail.m - this file is part of SOGo * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2013 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,10 +31,12 @@ #import #import +#include + #import "NSString+Mail.h" #import "NSData+Mail.h" -#if 1 +#if 0 #define showWhoWeAre() \ [self logWithFormat: @"invoked '%@'", NSStringFromSelector (_cmd)] #else @@ -97,6 +97,11 @@ return self; } +- (xmlCharEncoding) contentEncoding +{ + return XML_CHAR_ENCODING_UTF8; +} + - (void) dealloc { [ignoreContentTags release]; @@ -234,11 +239,12 @@ } - (void) characters: (unichar *) characters - length: (int) length + length: (NSUInteger) length { if (!ignoreContent) - [result appendString: [NSString stringWithCharacters: characters - length: length]]; + { + [result appendString: [NSString stringWithCharacters: characters length: length]]; + } } - (void) ignorableWhitespace: (unichar *) whitespaces @@ -339,14 +345,17 @@ - (NSString *) htmlToText { - id parser; _SOGoHTMLToTextContentHandler *handler; + id parser; + NSData *d; parser = [[SaxXMLReaderFactory standardXMLReaderFactory] createXMLReaderForMimeType: @"text/html"]; handler = [_SOGoHTMLToTextContentHandler htmlToTextContentHandler]; [parser setContentHandler: handler]; - [parser parseFromSource: self]; + + d = [self dataUsingEncoding: NSUTF8StringEncoding]; + [parser parseFromSource: d]; return [handler result]; }