Click or drag to resize
MimeKit

TextPartGetText Method (Encoding)

Get the decoded text and the encoding used to convert it into unicode.

Namespace:  MimeKit
Assembly:  MimeKit (in MimeKit.dll) Version: 3.0.0
Syntax
C#
public string GetText(
	out Encoding encoding
)

Parameters

encoding
Type: System.TextEncoding
The encoding used to convert the text into unicode.

Return Value

Type: String
The decoded text.
Exceptions
ExceptionCondition
ObjectDisposedException The TextPart has been disposed.
Remarks

If the charset parameter on the ContentType is set, it will be used in order to convert the raw content into unicode. If that fails or if the charset parameter is not set, the first 2 bytes of the content will be checked for a unicode BOM. If a BOM exists, then that will be used for conversion. If no BOM is found, then UTF-8 is attempted. If conversion fails, then iso-8859-1 will be used as the final fallback.

For more control, use GetText(Encoding) or GetText(String).

See Also