If the input buffer can be successfully encoded, the return value is the
length of the encoded output string. If the method returns zero,
then no text was encoded and the output string buffer will be empty.
If the method fails, the return value is MIME_ERROR. To get
extended error information, call GetLastError.
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 using the SetText method.
The class will automatically encode message text which contains non-ASCII
characters using the character set specified when the message is created.
If the nCharacterSet parameter is non-zero, the
method will encode the text using the specified character set. If
the Unicode version of this method is called, the input text is
converted to ANSI using the code page associated with the character
set. If the ANSI version of this method is called, the input text is
converted to Unicode using the system default code page, and then back
to ANSI using the specified character set.
If the nCharacterSet parameter specifies the
MIME_CHARSET_UTF16 character set, you must specify
MIME_ENCODING_BASE64 as the encoding method. Other encoding methods
are not supported for Unicode strings and 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 MIME_CHARSET_UTF8 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
MIME_ENCODING_BASE64 as the encoding method, with quoted-printable
encoding only used for legacy support.