1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-70] Added explicit BOM to HTML signature files, to prevent encoding errors

This commit is contained in:
Patrick Simpson 2017-03-02 11:27:39 +01:00
parent 8746702052
commit fbd899cc50

View File

@ -82,14 +82,27 @@ namespace Acacia.Stubs.OutlookWrappers
public void SetContent(string content, ISignatureFormat format) public void SetContent(string content, ISignatureFormat format)
{ {
string path = GetPath(format, false); WriteContent(content, format, false);
File.WriteAllText(path, content);
} }
public void SetContentTemplate(string content, ISignatureFormat format) public void SetContentTemplate(string content, ISignatureFormat format)
{ {
string path = GetPath(format, true); WriteContent(content, format, true);
File.WriteAllText(path, content); }
private void WriteContent(string content, ISignatureFormat format, bool isTemplate)
{
string path = GetPath(format, isTemplate);
if (format == ISignatureFormat.HTML)
{
// [KOE-70] If the html file does not have a BOM, it sometimes gives encoding errors.
File.WriteAllText(path, content, new UTF8Encoding(true));
}
else
{
File.WriteAllText(path, content);
}
} }
public string GetContentTemplate(ISignatureFormat format) public string GetContentTemplate(ISignatureFormat format)