CmConvertString
Description
This function converts an input string into the specified character set.
Syntax
int CMAPIENTRY CmConvertString(CMUINT flCtrl, const void *pszSrc, void *pszDst, CMUINT cbDst);
Parameter
flCtrl
CM_CONVERT_UTF8_TO_WCHAR
CM_CONVERT_UTF8_TO_UCS2LE
CM_CONVERT_UTF8_TO_ASCII
CM_CONVERT_UTF8_TO_UTF16
CM_CONVERT_UTF8_TO_LOCAL
CM_CONVERT_WCHAR_TO_UCS2LE
CM_CONVERT_WCHAR_TO_UTF8
CM_CONVERT_WCHAR_TO_ASCII
CM_CONVERT_WCHAR_TO_UTF16
CM_CONVERT_WCHAR_TO_LOCAL
CM_CONVERT_UCS2LE_TO_WCHAR
CM_CONVERT_UCS2LE_TO_UTF8
CM_CONVERT_UCS2LE_TO_ASCII
CM_CONVERT_UCS2LE_TO_UTF16
CM_CONVERT_UCS2LE_TO_LOCAL
CM_CONVERT_ASCII_TO_WCHAR
CM_CONVERT_ASCII_TO_UCS2LE
CM_CONVERT_ASCII_TO_UTF8
CM_CONVERT_ASCII_TO_UTF16
CM_CONVERT_ASCII_TO_LOCAL
CM_CONVERT_UTF16_TO_UTF8
CM_CONVERT_UTF16_TO_UCS2LE
CM_CONVERT_UTF16_TO_WCHAR
CM_CONVERT_UTF16_TO_ASCII
CM_CONVERT_UTF16_TO_LOCAL
CM_CONVERT_LOCAL_TO_UTF8
CM_CONVERT_LOCAL_TO_UCS2LE
CM_CONVERT_LOCAL_TO_WCHAR
CM_CONVERT_LOCAL_TO_ASCII
CM_CONVERT_LOCAL_TO_UTF16
pszSrc pointer to memory that holds the string to convert. It must be null-terminated and not longer than 64 Kbytes.
pszDst destination buffer.
cbDest holds the length of pszDst in bytes.
Return
Returns on success the number of converted characters (including terninating null character). The number of bytes varies depending on the encoding. For example, if using tag CM_CONVERT_UTF8_TO_UTF16, the function returns 15, the resulting string has also 15 characters but a size of 30 bytes. If an error occurs, zero is returned.
Notes
ASCII: 7bit encoding, ASCII-Norm.
WCHAR: wchar_t encoded, on Windows/CE UCS-2 and on Unix UTF-32.
UCS2LE: Little Endian encoded, without white blank mark.
LOCAL: 8bit local encoding.
UTF-8: UTF-8 encoded strings.
UTF-16: UTF-16 encoded strings.