The method returns the number of characters of encoded text.
A return value of zero indicates no text has been encoded. If the
method fails, it will return -1 and the LastError
property can be used to determine the cause of the failure. In
most cases where the method fails, it is because an invalid character
set or encoding type has been specified.
This method provides a means to encode text using either base64 or
quoted-printable encoding. It is not necessary to use this method to
encode text when assigning a value to the Text property.
The control will automatically encode message text which contains non-ASCII
characters using the character set specified when the message is created.
If the CharacterSet parameter s specified, the
method will convert the message text using the ANSI code page
associated with the character set, and then the text will be encoded.
If the parameter is omitted, the message text will be converted to
UTF-8 and then encoded.
If the mimeCharsetUTF16 character set is specified, you must
also specify mimeEncodingBase64 as the encoding method. Other encoding methods
are not supported and this will cause the method to
fail. It is not recommended you encode text as UTF-16 unless there is
a specific requirement to use that character set.
It is recommended that you use the mimeCharsetUTF8 character set
whenever possible. It is capable of
encoding all Unicode code points, and is a standard for virtually all
modern Internet applications. In most cases, it is preferable to use
mimeEncodingBase64 as the encoding method, with quoted-printable
encoding only used for legacy support.
If you are developing your application using Visual Basic 6.0,
the IDE does not provide complete support for Unicode. The decoded
text may appear to be corrupted when examining it in the debugger. This is because the IDE will attempt
to convert the string to ANSI using the system default code page. To
display Unicode text correctly, you must use controls which are Unicode
aware, such as the Microsoft InkEdit control.