Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > ldap_get_values: converting UTF8 encoding to ANSI MBCS string on UNIX systems

Reply
Thread Tools

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

 
 
Tejas
Guest
Posts: n/a
 
      11-14-2007
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.

 
Reply With Quote
 
 
 
 
William Ahern
Guest
Posts: n/a
 
      11-14-2007
Tejas <> wrote:
<snip>
> 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: 2to3 on Mac - unknown encoding: mbcs Gabriel Genellina Python 0 11-06-2009 06:42 AM
2to3 on Mac - unknown encoding: mbcs Skip Montanaro Python 0 11-06-2009 01:50 AM
strftime return value encoding (mbcs, locale, etc.) Giovanni Bajo Python 2 01-27-2008 10:25 PM
Encoding.Default and Encoding.UTF8 Hardy Wang ASP .Net 5 06-09-2004 04:04 PM
pep 277, Unicode filenames & mbcs encoding &c. Edward K. Ream Python 5 10-23-2003 06:16 AM



Advertisments