IMimeInternational::ConvertBuffer method

Converts the buffer from one code page to another code page.

Syntax

HRESULT ConvertBuffer(
  [in]      CODEPAGEID cpiSource,
  [in]      CODEPAGEID cpiDest,
  [in]      LPBLOB     pIn,
  [in, out] LPBLOB     pOut,
  [out]     ULONG      *pcbRead
);

Parameters

cpiSource [in]

Type: CODEPAGEID

Specifies the source code page ID for pIn. For more information, see CODEPAGEID.

cpiDest [in]

Type: CODEPAGEID

Specifies the code page ID to convert pIn into. For more information, see CODEPAGEID.

pIn [in]

Type: LPBLOB

Specifies a pointer to the a BLOB structure that contains the source buffer.

pOut [in, out]

Type: LPBLOB

Receives a pointer to the a BLOB structure that contains the converted buffer and the size. The client is responsible for freeing pOut->pBlobData by calling IMalloc::Free.

pcbRead [out]

Type: ULONG*

Receives a pointer to a that contains the number of bytes read from pIn->pBlobData. This value can be less than or equal to pIn->cbSize.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Indicates success.
E_INVALIDARG
Indicates that pIn, pIn->pBlobData, or pOut is NULL.
E_FAIL
Indicates that there is nothing to convert or that a call to Mlang.dll to convert the buffer failed.
E_OUTOFMEMORY
Indicates that an attempt to allocate memory failed.
MIME_S_CHARSET_CONFLICT
Indicates that pIn->pBlobData contains characters that could not be converted to cpiDest without data loss. This can happen when pIn->pBlobData contains characters from multiple code pages or is Unicode. A client can work around this problem by converting the buffer to Unicode, UTF-7, or UTF-8.

Remarks

A client may want to call IMimeInternational::CanConvertCodePages before calling this method to make sure that it is valid to convert from cpiSource to cpiDest.

On successful return, pcbRead contains the number of bytes read from pIn->pBlobData. It is possible that pcbRead may not equal pIn->cbSize. For example, this can happen when pIn contains a double-byte character set (DBCS) buffer in which the last character of the buffer is a lead byte. The client is responsible for handling this case when converting a large stream of text by using multiple calls to IMimeInternational::ConvertBuffer.

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)