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

T

Tejas

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 on UNIX platforms (or same call which works on both UNIX &
Windows) ?

Thanks in advance,
Ravi Nandibhatla.
 
W

William Ahern

Tejas said:
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 on UNIX platforms (or same call which works on both UNIX &
Windows) ?

$ man 3 iconv

alternatively, http://www.icu-project.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top