473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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.

Nov 14 '07 #1
1 4276
Tejas <na*********@gmail.comwrote:
<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/
Nov 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manoj Nair | last post by:
I am using following code to create an XML file and which is rendered into a PDF by using XMLParser and then FOP. This works fine on windows system. But when I port the code to Unix I get "utf8...
1
by: James | last post by:
this is a console program to convert ANSI to UTF8 format. Although in notepad i open the source file (which is ansi), and after running the program below, and re-open in notepad (it shows utf8...
8
by: tbh | last post by:
for historical reasons i need to be able to call, from C# under DotNet 2, as COM+ DLL function that returns a "string" which is really an array of seemingly arbitrary bytes (presumably non-zero)....
8
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z | last post by:
I lookup the utf-8 form of delta from the link. http://www.fileformat.info/info/unicode/char/0394/index.htm and then I want to print it in the python ( I work under windows) #!/usr/bin/python...
7
by: amygdala | last post by:
Hi, I'm trying to let PHP write a 'sitemap.xml' sitemap for Google and other searchengines. It's working, except that the content in the XML file doesn't seem to be UTF8. (Which it should be,...
0
by: Alci | last post by:
I am getting some Korean characters data from MS SQL server. These data were submitted as UTF-8 into the database, but stored as normal varchars. So, when I getting them out of database by using...
2
by: Giovanni Bajo | last post by:
Hello, I am trying to find a good way to portably get the output of strftime() and put it onto a dialog (I'm using PyQt, but it doesn't really matter). The problem is that I need to decode the...
7
by: firepol | last post by:
Hello there, I am dealing with files encoded in UTF8 and I can't find a way to convert them into ANSI. I've already searched in google for this since a while, and I'm not achieving the result I...
6
by: ogtheterror | last post by:
Hi I have a very limited understanding of Python and have given this the best shot i have but still have not been able to get it working. Is there anyone that knows how to get this into a .net...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.