IText PartTry Detect Encoding Method
Definition
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
bool TryDetectEncoding(
out Encoding?? encoding,
out TextEncodingConfidence? confidence
)Parameters
- encoding Encoding
- The detected encoding; otherwise, .
- confidence TextEncodingConfidence
- The confidence in the detected encoding being correct.
Return Value
Booleanif an encoding was detected; otherwise, .
Remarks
Attempts to detect the encoding of the text content.
If no content is defined, then encoding is set to ASCII and confidence is set to Irrelevant.
If a charset is specified on the Content-Type header and it is a supported encoding, then encoding is set to the encoding for the specified charset and confidence is set to Certain.
If a Byte-Order-Mark (BOM) is found, then encoding is set to the corresponding unicode encoding and confidence is set to Certain.
If the content is in HTML format, then the first 1024 bytes are processed for <meta> tags containing charset information. If charset information is found and the charset is a supported encoding, then encoding is set to the encoding for the specified charset and confidence is set to Tentative.
Exceptions
| ObjectDisposedException | The ITextPart has been disposed. |