ImapUtilsToLiteral Method (String, Encoding, Encoding)
Converts a text string into IMAP LITERAL+ string.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public static string ToLiteral(
	string s,
	Encoding charsetEncoding,
	Encoding requestEncoding
)

Parameters

s
Type: SystemString
The text string to convert.
charsetEncoding
Type: System.TextEncoding
Denotes the charset of the resulting string. If a null reference (Nothing in Visual Basic), UTF8 is used. Must match the charset specified in Search(Boolean, String, String) method call.
requestEncoding
Type: System.TextEncoding
Must match RequestEncoding value. If a null reference, DefaultEncoding is used (RequestEncoding uses the same default value).

Return Value

Type: String
The encoded LITERAL+ string, or an empty quoted string ("") if the source string is an empty string or a null reference.
Remarks

You'll typically use this method to build search string in non-ASCII charset when the IMAP server is Gmail.

If you're using UTF-8 charset for search strings and you never changed RequestEncoding from its default value, use ToLiteral(String) overload instead.

Note Note
This method produces literals in very efficient LITERAL+ syntax. Gmail does not advertize the support of LITERAL+ extension but it's actually supported.
See Also