Share via


IMimeInternational::EncodeHeader method

Encodes a message header string.

Syntax

HRESULT EncodeHeader(
  [in]      HCHARSET      hCharset,
  [in]      LPPROPVARIANT pData,
  [out]     LPSTR         *ppszEncoded,
  [in, out] LPRFC1522INFO pRfc1522Info
);

Parameters

hCharset [in]

Type: HCHARSET

Specifies the handle of the character set to use to encode the header.

pData [in]

Type: LPPROPVARIANT

Specifies a pointer to the PROPVARIANT structure that contains the header to encode (either pData->pszVal or pData->pwszVal).

ppszEncoded [out]

Type: LPSTR*

Receives a pointer to an LPSTR that contains the encoded header. The client is responsible for freeing this pointer by calling IMalloc::Free.

pRfc1522Info [in, out]

Type: LPRFC1522INFO

Receives a pointer to the RFC1522INFO structure that contains RFC 1522 encoding information for the header.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Indicates success.
E_INVALIDARG
Indicates that pData or ppszEncoded is NULL or that pData->vt is not equal to VT_LPSTR ro VT_LPWSTR.
MIME_E_INVALID_HANDLE
Indicates that hCharset is an invalid handle.
E_FAIL
Indicates that hCharset is NULL and an appropriate default character set does not exist.
E_OUTOFMEMORY
Indicates that an attempt to allocate memory failed.

Remarks

Encoding converts the header string to a Internet code page and may apply RFC 1522 encoding if the header contains 8-bit characters.

If hCharset is NULL, the default header character set is used to convert the header to an Internet code page.

The valid values for pData->vt include VT_LPSTR or VT_LPWSTR. If the header is going to be encoded into 7-bit Unicode Transformation Format (UTF-7) or 8-bit Unicode Transformation Format (UTF-8), the client should use VT_LPWSTR to pass the header text into this method to minimize data loss.

When pRfc1522Info->fRfc1522Allowed is FALSE, MimeOLE does not attempt to encode the header using RFC 1522. RFC 1522 should not be used in non-MIME messages.

When pRfc1522Info->fRfc1522Allowed is equal to TRUE, and pRfc1522Info->fAllow8bit is set to TRUE, MimeOLE does not attempt to encode the header using RFC 1522.

When pRfc1522Info is NULL, MimeOLE defaults pRfc1522Info->fRfc1522Allowed to TRUE and pRfc1522Info->fAllow8bit to FALSE.

When RFC 1522 encoding is used to encode the header, pRfc1522Info->fRfc1522Used is set to TRUE. Otherwise, it is set to FALSE.

When the header is going to be encoded into UTF-7 or UTF-8, it is always encoded using RFC 1522, no matter what pRfc1522Info specifies.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Product
Outlook Express 6.0
Header
Mimeole.h
IDL
Mimeole.idl
DLL
Inetcomm.dll (version 6.0 or later)