Skip to content

Commit

Permalink
Fixed TextPreviewer to use an encoding with an empty string fallback
Browse files Browse the repository at this point in the history
This was causing some MailKit unit tests to fail because the default
for Encoding.GetEncoding(int codepage) must have changed between net6.0
and net8.0 to fall back to using "?" as a fallback string for incomplete
or invalud character sequences.

Anyway, explicitly use string.Empty as the fallback.
  • Loading branch information
jstedfast committed Nov 28, 2024
1 parent e364e1a commit ba67d12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MimeKit/Text/TextPreviewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public virtual string GetPreviewText (Stream stream, string charset)
Encoding encoding;

try {
encoding = CharsetUtils.GetEncoding (charset);
encoding = CharsetUtils.GetEncoding (charset, string.Empty);
} catch (NotSupportedException) {
encoding = CharsetUtils.UTF8;
}
Expand Down

0 comments on commit ba67d12

Please sign in to comment.