'Outlook 365 vs Professional [save mailitem] Encoding Issues

I have an outlook addin currently in development that reads mail properties from outlook and displays on a winform.

I built the outlook on an environment with outlook professional 2013. All functionalities are good. Properties like, sendername, from, to etc..gets readably displayed on a winform.

This is how i access the properties of a mail.

Outlook.MailItem mail;
mail.Sender.Name;

Now, If i take the addin on an environment with the same system locale but different outlook (Outlook 365)

I experience decoding issues when trying to read some particular mails. So for example if i am accessing a mail from sender : Adèle

Outlook.MailItem mail;
mail.Sender.Name; // ---> This returns Ad?le

The mail has a UTF-8 encoding when i checked with outlook spy. The PC locales are the same.

One weird thing is, I copied the mail from the outlook 365 environment to the other (outlook professional) and have the issue, but when i copy the mail and import from the outlook professional environment to the outlook 365, it works correctly. So i think this has to do with the way outlook 365 saves or represents it's objects ? How can i approach this issue ? Is it fixable on my end ?



Solution 1:[1]

Outlook Object Model (just like all IDispatch-friendly COM libraries) returns strings in the UTF-16 (2 bytes) encoding.

Make sure you display strings in a way that does not convert strings to a single byte encoding.

Do you see the same problem in OutlookSpy (I am its author)?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1