You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the BodyBuilder is used to convert a MSG file to EML, and the text contains something like "Subject: Re: BabyBjörn Meeting" the calling ToString() on the resulting MimeMessage throws
{"Unable to translate bytes [F6] at index 1205 from specified code page to Unicode."}
Here is a redacted snip of the MimeMessage.Body:
{Content-Type: text/plain; charset=utf-8
I could meet at 12pm for 30 minutes so we'll need to work through the assortment quick.
It's important to note that you SHOULD NOT be using message.ToString () in order to serialize the message. It's meant more for the purpose of debugging. You really need to use WriteTo(Stream) (which can be a MemoryStream if you want to store it in a db or something)
That said, this exception is now caught allowing the code to fallback to using iso-889-1.
Sure, no problem. FWIW, the reason that ToString() can never really be guaranteed to be accurate is that it assumes that the entire message stream is a single charset (which is not guaranteed to be the case). For example, you might have multiple attachments with different charsets or headers with different charsets, etc.
When the BodyBuilder is used to convert a MSG file to EML, and the text contains something like "Subject: Re: BabyBjörn Meeting" the calling ToString() on the resulting MimeMessage throws
{"Unable to translate bytes [F6] at index 1205 from specified code page to Unicode."}
Here is a redacted snip of the MimeMessage.Body:
{Content-Type: text/plain; charset=utf-8
I could meet at 12pm for 30 minutes so we'll need to work through the assortment quick.
Jeff
-----Original Message-----
Subject: Re: BabyBjörn Meeting
Sorry - Im booked until noon. Can you do 12:00, 12:30 or 1:00.
Here is the trace information:
? mkMessage.ToString()
{"Unable to translate bytes [F6] at index 1205 from specified code page to Unicode."}
_className: Nothing
_COMPlusExceptionCode: -532462766
_data: {System.Collections.ListDictionaryInternal}
_dynamicMethods: Nothing
_exceptionMethod: Nothing
_exceptionMethodString: Nothing
_helpURL: Nothing
_HResult: -2147024809
_innerException: Nothing
_ipForWatsonBuckets: 8791554014329
_message: "Unable to translate bytes [F6] at index 1205 from specified code page to Unicode."
_remoteStackIndex: 0
_remoteStackTraceString: Nothing
_safeSerializationManager: {System.Runtime.Serialization.SafeSerializationManager}
_source: Nothing
_stackTrace: {SByte()}
_stackTraceString: Nothing
_watsonBuckets: Nothing
_xcode: -532462766
_xptrs: 0
BytesUnknown: {Length=1}
bytesUnknown: {Length=1}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
HResult: -2147024809
index: 1205
Index: 1205
InnerException: Nothing
IPForWatsonBuckets: 8791554014329
IsTransient: False
m_paramName: Nothing
Message: "Unable to translate bytes [F6] at index 1205 from specified code page to Unicode."
ParamName: Nothing
RemoteStackTrace: Nothing
s_EDILock: {Object}
Source: "mscorlib"
StackTrace: " at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index) at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index) at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes) at System.Text.UTF8Encoding.FallbackInvalidByteSequence(Byte* pSrc, Int32 ch, DecoderFallbackBuffer fallback) at System.Text.UTF8Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder) at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count) at MimeKit.MimeMessage.ToString()"
TargetSite: {Void Throw(Byte[], Int32)}
WatsonBuckets: Nothing
The text was updated successfully, but these errors were encountered: