- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi rase,
Which language do you prefer.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page