Directory Services

LdapUnicodeToUTF8

Modules that do not have the UTF-8 code page can call the LdapUnicodeToUTF8 function to convert Unicode strings to UTF-8.

int LdapUnicodeToUTF8(
  LPCWSTR lpSrcStr,
  int cchSrc,
  LPSTR lpDestStr,
  int cchDest
);

Parameters

lpSrcStr
[in] Pointer to a null-terminated Unicode string to convert.
cchSrc
[in] Specifies the number of characters in the lpSrcStr string.
lpDestStr
[out] Pointer to a buffer that receives the converted UTF-8 character string, without a null terminator.
cchDest
[in] Specifies the size, in characters, of the lpDestStr buffer.

Return Values

The return value is the number of characters written to the lpDestStr buffer.

If the lpDestStr buffer is too small, GetLastError returns ERROR_INSUFFICIENT_BUFFER.

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.

See Also

Functions, LdapUTF8ToUnicode