Community
cancel
Showing results for 
Search instead for 
Did you mean: 
rase
New Contributor I
91 Views

conversion to Unicode

Jump to solution
Could somebody be so kind and tell a newbie how to convert a string of single byte characters (char) to a string of Unicode characters (wchar) in a way that the characters with more than 7 bits (e. g. German Umlaute, French accents) are treated correctly?
0 Kudos
1 Solution
JenniferJ
Moderator
91 Views
6 Replies
rase
New Contributor I
91 Views
In the meantime I found a solution: the function btowc converts single characters to Unicode, including 8 bit characters. Does somebody know a better solution, for example for a whole string?
Judith_W_Intel
Employee
91 Views
Quoting - rase
In the meantime I found a solution: the function btowc converts single characters to Unicode, including 8 bit characters. Does somebody know a better solution, for example for a whole string?

Does mbtowc do what you want?
JenniferJ
Moderator
92 Views
dpeterc
Beginner
91 Views
I use "iconv" library for this purpose. It allows you to make arbitrary conversions from different source and destinantion encodings.
http://www.gnu.org/software/libiconv/
It is licensed as LGPL, so you can also use it in commercial products.
This library is standard on Linux, used by many programs. So if your platform is Linux, you can expect it to be already installed.
rase
New Contributor I
91 Views
Thanks a lot for your answers. Judith: the function does what I want, but I suspected that there are other solutions which were provided by the other contributors.
woleakande
Beginner
91 Views

Hi rase,

Which language do you prefer.

Reply