Closed MacDisein closed 7 months ago
How are you decoding it? I added it as a unit test and it works fine:
[Test]
public void TestDecodeIso88592 ()
{
const string text = "=?iso-8859-2?q?AW=3A_Dostawa_=BFelatyny_=282361=29_PO?=\r\n =?iso-8859-2?q?_4500367149?=";
const string expected = "AW: Dostawa żelatyny (2361) PO 4500367149";
var buffer = Encoding.UTF8.GetBytes (text);
string result;
int codepage;
result = Rfc2047.DecodeText (ParserOptions.Default, buffer, 0, buffer.Length, out codepage);
Assert.That (result, Is.EqualTo (expected), "DecodeText");
Assert.That (codepage, Is.EqualTo (28592), "DecodeText");
result = Rfc2047.DecodeText (ParserOptions.Default, buffer, 0, buffer.Length);
Assert.That (result, Is.EqualTo (expected), "DecodeText");
result = Rfc2047.DecodeText (ParserOptions.Default, buffer);
Assert.That (result, Is.EqualTo (expected), "DecodeText");
result = Rfc2047.DecodeText (buffer);
Assert.That (result, Is.EqualTo (expected), "DecodeText");
}
Hmmm, just remembered something.
Did you remember to register non-Unicode text encodings?
System.Text.Encoding.RegisterProvider (System.Text.CodePagesEncodingProvider.Instance);
That's it!!
Great - thank you!
I have a problem with the subject of a MIME message. The header field is not decoded correctly.
The RawValue of the field is:
The decoded result from the MimeKit is:
AW: Dostawa ¿elatyny (2361) PO 4500367149
The correct result should look like this:
AW: Dostawa żelatyny (2361) PO 4500367149
Am I doing something wrong or is this actually a bug?
I am using MimeKit 4.3.0 on Windows with .NET 8