Share via


IMimeInternational::DecodeHeader method

Decodes a message header string.

Syntax

HRESULT DecodeHeader(
  [in]      HCHARSET      hCharset,
  [in]      LPCSTR        pszData,
  [in, out] LPPROPVARIANT pDecoded,
  [in, out] LPRFC1522INFO pRfc1522Info
);

Parameters

hCharset [in]

Type: HCHARSET

Specifies the handle of the character set to use to decode the header text.

pszData [in]

Type: LPCSTR

Specifies a LPCSTR that contains the header to decode.

pDecoded [in, out]

Type: LPPROPVARIANT

Receives a pointer to the PROPVARIANT structure that contains the decoded header.

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.
MIME_E_INVALID_HANDLE
Indicates that hCharset is an invalid handle.
E_FAIL
Indicates that hCharset is NULL and an appropriate character set cannot be identified to decode the header in.
MIME_S_NO_CHARSET_CONVERT
Indicates that a character set conversion failed or was not performed on the header.
E_OUTOFMEMORY
Indicates that an attempt to allocate memory failed.
E_INVALIDARG
Indicates that pszData or pDecoded is NULL or that pDecoded->vt is not equal to VT_LPSTR ro VT_LPWSTR.

Remarks

The header is passed in pszData. If the header was encoded using RFC 1522, the RFC 1522 encoding is removed and information about the RFC 1522 encoding is returned in pRfc1522Info. When the header is decoded successfully, it is returned in pDecoded. The header is converted from an Internet code page to the Windows code page as specified by hCharset.

If hCharset is NULL and the header is encoded in RFC 1522, the character set from the RFC 1522 encoding is used to translate the header. Otherwise, if hCharset is NULL and the string is not encoded in RFC 1522, the default character set is used to translate the header.

If hCharset is not NULL, hCharset is always used to translate the header to a Windows code page, even if the header is encoded in RFC 1522. This overrides the character set contained in the RFC 1522 encoding.

If the header was encoded in RFC 1522, pRfc1522Info->fRfc1522Used is set to TRUE and pRfc1522Info->hRfc1522Cset is set to the character set that was contained in the RFC 1522 encoding. Otherwise, if the header was not RFC 1522 encoded, pRfc1522Info->fRfc1522Used is set to FALSE and pRfc1522Info->hRfc1522Cset is set to NULL.

The valid values for pDecoded->vt include VT_LPSTR or VT_LPWSTR. If VT_LPWSTR is specified, MimeOLE decodes the header into a Unicode string. Using VT_LPWSTR is optimal because if a string is encoded in Unicode Transformation Format (UTF), there is no data loss during decoding.

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)