Fix mojibake in signature: detect real encoding instead of assuming UTF-8
Outlook writes signature .htm files in the system ANSI code page (windows-1251 on Russian Windows) without a BOM, but File.ReadAllText defaults to UTF-8 for BOM-less files - mangling Cyrillic into replacement characters. ReadSignatureHtml now checks BOM, then a <meta charset> tag, then falls back to Encoding.Default (the actual system code page) before ever assuming UTF-8. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f04de700d9
commit
cb3b273741
2 files changed
+140
-2
No files matched your search
@@ -58,7 +58,7 @@ namespace BulkArchiveMailer.AddIn.UI
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(settings.SignatureHtmlPath))
|
||||
{
|
||||
return File.Exists(settings.SignatureHtmlPath) ? File.ReadAllText(settings.SignatureHtmlPath) : null;
|
||||
return File.Exists(settings.SignatureHtmlPath) ? SignatureReader.ReadSignatureHtml(settings.SignatureHtmlPath) : null;
|
||||
}
|
||||
|
||||
return SignatureReader.TryAutoDetectSignatureHtml(outlookApplication);
|
||||
|
||||
Reference in new issue
Block a user