From 2cf77b6145c0e35ff984cf1f8c51bd3d0b08977e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 8 Apr 2022 11:21:48 -0400 Subject: [PATCH] fix(mail): force TNEF body parts to be decoded in UTF-8 --- SoObjects/Mailer/SOGoTNEFMailBodyPart.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SoObjects/Mailer/SOGoTNEFMailBodyPart.m b/SoObjects/Mailer/SOGoTNEFMailBodyPart.m index 997f6847f..b76104fdd 100644 --- a/SoObjects/Mailer/SOGoTNEFMailBodyPart.m +++ b/SoObjects/Mailer/SOGoTNEFMailBodyPart.m @@ -825,8 +825,14 @@ unsigned char GetRruleMonthNum(unsigned char a, unsigned char b) { ASSIGN (part, newPart); if (newPart) { + NSMutableDictionary *info; + + info = [NSMutableDictionary dictionaryWithDictionary: [newPart bodyInfo]]; + if ([newPart encoding]) + [info setObject: [newPart encoding] + forKey: @"encoding"]; [self setFilename: [[newPart bodyInfo] filename]]; - [self setPartInfo: [newPart bodyInfo]]; + [self setPartInfo: info]; } else { @@ -884,6 +890,10 @@ unsigned char GetRruleMonthNum(unsigned char a, unsigned char b) { [map setObject: [NSString stringWithFormat: @"%@/%@", _type, _subtype] forKey: @"content-type"]; + // Encoding + [map setObject: @"utf-8" + forKey: @"content-transfer-encoding"]; + /* prepare body content */ content = [NSData dataWithBytes: [_data bytes] length: [_data length]];