TnefConvertToUnicode

This function converts a string encoded with a specific code page to Unicode.

At a Glance

Header file: Tnefapi.h
Platforms: H/PC 3.0
Windows CE versions: 2.10 and later

Syntax

INT WINAPI TnefConvertToUnicode (UINT CodePage, DWORD dwFlags,
LPCSTR
lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr,
int
cchWideChar);

Parameters

CodePage
[in] Unsigned integer that contains the number of the code page to decode from. The following table shows supported code pages.
Code page
Name
Contains
1250 Windows 1250 Central European languages
1251 Windows 1251 Cyrillic
1252 Windows 1252 Western European languages
1253 Windows 1253 Greek
1254 Windows 1254 Turkish
1255 Windows 1255 Hebrew
1256 Windows 1256 Arabic
1257 Windows 1257 Baltic languages
1258 Windows 1258 Vietnamese
20866 KOI8-R Russian Cyrillic standard
21886 KOI8-U Ukrainian Cyrillic standard
28592 ISO 8859-2 Central European languages
28593 ISO 8859-3 Esperanto/Galician/Maltese/ incomplete Turkish
28594 ISO 8859-4 Baltic languages
28595 ISO 8859-5 Cyrillic
28596 ISO 8859-6 Arabic
28597 ISO 8859-7 Greek
28598 ISO 8859-8 Hebrew
28599 ISO 8859-9 Turkish
28600 ISO 8859-10 Nordic languages, except Skolt Sami
28604 ISO 8859-14 Celtic
28605 ISO 8859-15 Western Europe, updated
65000 UTF-7 7-bit Unicode encoding
65001 UTF-8 8-bit Unicode encoding

dwFlags
[in] Specifies a bitmask of flags that indicate whether to translate to precomposed or composite wide characters if a composite form exists, whether to use glyph characters in place of control characters, and how to deal with invalid characters. It can be combination of the following flag constants:
MB_PRECOMPOSED
Always use precomposed characters—that is, characters in which a base character and a nonspacing character have a single character value. If an H/PC 3.0 does not recognize the value in CodePage, it defaults to MB_PRECOMPOSED. This flag cannot be used with MB_COMPOSITE.
MB_COMPOSITE
Always use composite characters—that is, characters in which a base character and a nonspacing character have different character values. This flag cannot be used with MB_PRECOMPOSED.
MB_ERR_INVALID_CHARS
If the function encounters an invalid input character, it fails and GetLastError returns ERROR_NO_UNICODE_TRANSLATION.
MB_USEGLYPHCHARS
Use glyph characters instead of control characters

The function’s default behavior is to translate to the precomposed form. If a precomposed form does not exist, the function attempts to translate to a composite form.

The flags MB_PRECOMPOSED and MB_COMPOSITE are mutually exclusive. The MB_USEGLYPHCHARS flag and the MB_ERR_INVALID_CHARS can be set regardless of the state of the other flags.

lpMultiByteStr
[in] Long pointer to the input string.
ccMultiByte
[in] Character count of the input string.
lpWideCharStr
[in] Long pointer to the output buffer.
cchWideChar
[in] Integer that returns the character count of the output buffer

Return Values

The number of characters copied to the output buffer indicates success. If the output buffer size is 0, the function returns the size of the buffer required to contain the output string. Zero indicates failure.

See Also

ModifiedUTF7ToUnicode, UnicodeToModifiedUTF7