View Issue Details

IDProjectCategoryView StatusLast Update
0005408SOGoActiveSyncpublic2021-10-27 12:35
Reporteroburais Assigned Tofrancis  
Status resolvedResolutionfixed 
Platform[Server] LinuxOSDebianOS Version8 (Jessie)
Product Version5.2.0 
Fixed in Version5.3.0 
Summary0005408: Attachment get corrupted in Outlook with ActiveSync when the filename contains non-ASCII characters and the CharSet is not UTF-8

When displaying an email with an attachment whole filename contains a non-ASCII character (such as an accent) with Outlook 2013,2016 or 2019 using ActiveSync, the attachment gets corrupted.
The corruptions occurs when the charset encoding for body of the email is set ISO-8859-1 or windows-1252. (disregarding the charset encoding of the filename of the attachment itself).
The attachment is fine within SOGo webmail (or with any IMAP client).

Steps To Reproduce
  • using SOGo 5.2.0 with activesync.
  • Send an email with a attachment name such as "accentué.pdf" to the mail server (with Thunderbird for instance, forcing the outgoing charset to ISO-8859-1, or with Outlook 2013+)
  • Read the email in Outlook 2013+ using the activesync protocol, and try open the attachment.

If you edit the charset of the body of the email itself to us-ascii on the email server, the attachment is readable again.

Additional Information

When comparing the corrupted attachment to the working one with an hexadecimal editor, you can notice that a charset conversion is applied to the binary code of the attachment itself.
For instance, an hex of "e2" gets translated as "c3a2" within the attachment, changing the integrity of the file and corrupting it.
Hence the bigger size of the attachment.

Tagsactive sync, ActiveSync, attachement, outlook, sogo, unicode, utf-8




2021-10-19 10:09

reporter   ~0015563

When Downgrading to SOGo 4.1 and re-adding the account in Outlook, the attachment is working as expected



2021-10-19 11:26

reporter   ~0015564

Can you please provide a sample mail in raw format?



2021-10-21 09:59

reporter   ~0015568

Sorry I've uploaded the file in a private post.

Here it is :
Sample email sent from Outlook 2013 with an attachment named "accentué.pdf". Readable in SOGo, and any IMAP client. The attachment is corrupted when read from Outlook with ActiveSync (SOGo 5.2.0).

withaccent-2.eml (427,989 bytes)


2021-10-21 12:15

reporter   ~0015569


I have the same problem! The hungarian special characters transformed to strange characters and the attachment can not opening.
Here is an sample.

Best regards: Péter



2021-10-24 18:02

reporter   ~0015573

I'm able to reproduce the problem with withaccent-2.eml, but I see the same problem with SOGo 4.1.0.
Although I have a potential fix for this ( I'd like to understand where the problem comes from.
@oburais - Can you confirm that the problem doesn't occure with SOGo 4.1.0. Does it work for you when the attachment name doesn't contain non-ascii chars?



2021-10-25 06:51

reporter   ~0015574

Hi @tfu

WIth SOGo 4.1.0 : the attachment is working in Outlook whether its name contains non-ascii characters or not.
With SOGo 5.2.0 : the attachment is corrupted in the same Outlook client only if its name contains non-ascii characters.

The symptoms appeared after upgrading from 4.1.0 to 5.2.0. They disappeared once downgraded to 4.1.0
(However, the Outlook profiles had to be deleted once downgraded so tha



2021-10-25 06:54

reporter   ~0015575

*so that the emails and their attachments were re-downloaded.

Editing the charset of the body of the email to us-ascii removed the corruption as well ( and the attachment was working, with still a non-ascii character in its filename).



2021-10-26 19:06

reporter   ~0015586

I identified following sope fix as the cause of this bug : fix(mime): encode text parts individually - Fixes 0005376 -



2021-10-27 12:35

administrator   ~0015587

Thanks @tfu!

Related Changesets

sogo: master bfcb0b92

2021-10-27 08:34


Committer: GitHub

Details Diff
fix(eas): use base64 encoding for attachments when sanitize emails + content-length

Fixes 0005408
Affected Issues
mod - ActiveSync/SOGoMailObject+ActiveSync.m Diff File

Issue History

Date Modified Username Field Change
2021-10-18 12:05 oburais New Issue
2021-10-18 12:05 oburais Tag Attached: active sync
2021-10-18 12:05 oburais Tag Attached: ActiveSync
2021-10-18 12:05 oburais Tag Attached: attachement
2021-10-18 12:05 oburais Tag Attached: outlook
2021-10-18 12:05 oburais Tag Attached: sogo
2021-10-18 12:05 oburais Tag Attached: unicode
2021-10-18 12:05 oburais Tag Attached: utf-8
2021-10-19 10:09 oburais Note Added: 0015563
2021-10-19 11:26 tfu Note Added: 0015564
2021-10-21 09:59 oburais Note Added: 0015568
2021-10-21 09:59 oburais File Added: withaccent-2.eml
2021-10-21 12:15 peter.barlabas Note Added: 0015569
2021-10-21 12:15 peter.barlabas File Added: Meszlényi-Autó Kft. - Lezárt munkalap lista (584 KB).msg
2021-10-24 18:02 tfu Note Added: 0015573
2021-10-25 06:51 oburais Note Added: 0015574
2021-10-25 06:54 oburais Note Added: 0015575
2021-10-26 19:06 tfu Note Added: 0015586
2021-10-27 12:34 Changeset attached => sogo master bfcb0b92
2021-10-27 12:35 francis Assigned To => francis
2021-10-27 12:35 francis Status new => resolved
2021-10-27 12:35 francis Resolution open => fixed
2021-10-27 12:35 francis Fixed in Version => 5.3.0
2021-10-27 12:35 francis Note Added: 0015587