Hello,
We have an issue with EML to MSG conversion when the subject contains unicode characters.
Conversion is successful but the subject in the MSG file is incorrect.
For example, the subject “DSI_SINIV_01 (Modèle de test)” is converted to “DSI_SINIV_01 (Modèle de test)” in the MSG file.
We use the following code to perform the conversion :
private IEnumerable<byte[]> ConvertEmlToMsg(ConvertFileRequestDto p_FichierSource)
{
List<byte[]> result = new List<byte[]>();
SetLicense();
using (MemoryStream documentSource = new MemoryStream(p_FichierSource.Content))
{
Func<Stream> stream = () => documentSource;
// Create ConverterSettings and specify logger.
Func<ConverterSettings> settingsFactory = () => new ConverterSettings
{
Logger = new CustomGroupDocsLogger()
};
Func<LoadOptions> loadOptionsFactory = () =>
{
return new EmailLoadOptions
{
// Conversion du conteneur (= objet et corps de mail)
ConvertOwner = true,
// Les pièces jointes sont conservées dans leur format d'origine
ConvertOwned = false,
Depth = 1,
DisplayCcEmailAddress = true,
DisplayBccEmailAddress = true
};
};
using (Converter converter = new Converter(stream, loadOptionsFactory, settingsFactory))
{
EmailConvertOptions convertOptions = new EmailConvertOptions
{
Format = EmailFileType.Msg
};
using (MemoryStream output = new MemoryStream())
{
converter.Convert(() => output, convertOptions);
result.Add(output.ToArray());
}
}
}
return result;
}
And here is a sample EML file :
Date: Thu, 8 Feb 2024 13:49:38 +0100 (CET)
From: sender@domain.fr
To: test@domain.fr
Subject: =?utf-8?B?RFNJX1NJTklWXzAxIChNb2TDqGxlIGRlIHRlc3Qp?=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This is a test message.