IText |
bool TryDetectEncoding( out Encoding encoding, out TextEncodingConfidence confidence )
Exception | Condition |
---|---|
ObjectDisposedException | The ITextPart has been disposed. |
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.