ldap_get_values: converting UTF8 encoding to ANSI MBCS string on UNIX systems

8 views
Skip to first unread message

Tejas

unread,
Nov 14, 2007, 11:21:36 AM11/14/07
to openldap
Hi,

I am using ldap_get_values() call to get the user attributes from
LDAP.

This call is returning the user attributes in UTF-8 encoding and its a
PCHAR*. For normal English characters this is working well. When
Multibyte characters are involved like Japanese, Chinese or Korean, I
need to convert UTF8 to ANSI encoding to get the correct values.

On Windows platform I am using MultiByteToWideChar() with the code
page CP_UTF8 to convert it to wide character string and converting it
back to ANSI string using the ATL macro W2A() with USES_CONVERSION.

I need to do the same conversion on UNIX machines. I can think of
mbstowcs() and wcstombs(). However these two calls don't change the
encoding.

Can someone let me know how do I change the encoding from UTF-8 to
ANSI string ?

Thanks in advance,
Ravi Nandibhatla.

Reply all
Reply to author
Forward
0 new messages