sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Bint's Avatar

unicode string to C string?


Question posted by: Bint (Guest) on January 11th, 2008 02:35 AM
Hello, is Unicode part of C/C++? I have some unicode data, and I need to
get some kind of ASCii C string from it. Is that possible?

Thanks
B


3 Answers Posted
Bint's Avatar
Guest - n/a Posts
#2: Re: unicode string to C string?

thanks!


cr88192's Avatar
Guest - n/a Posts
#3: Re: unicode string to C string?


"Bint" <bint@csgs.comwrote in message
news:13odl3cq69fpsc6@corp.supernews.com...
Quote:
Originally Posted by
Hello, is Unicode part of C/C++? I have some unicode data, and I need to
get some kind of ASCii C string from it. Is that possible?
>


I may also mention, that depending on ones' needs, UTF-8 may be worth
looking into.

reason:
UTF-8, for plain ASCII characters, is exactly the same as the ASCII version;
it can also preserve the unicode range, by encoding non-ASCII characters as
multiple bytes, and so, very often, we can work with UTF-8 data in much the
same way as with plain ASCII.

also, unlike Unicode (in particular, UTF-16), in most cases we can utilize
ASCII and UTF-8 strings interchangably.


the main cost, however, is that in most common compilers, char is signed by
default (causing there to be negative char values, or us having to cast to
'unsigned char' in cases where we actually care), but this is a pretty minor
issue most of the time.


just my opinion mostly...

Quote:
Originally Posted by
Thanks
B
>
>


Sherman Pendley's Avatar
Sherman Pendley January 11th, 2008 06:25 PM
Guest - n/a Posts
#4: Re: unicode string to C string?

"Bint" <bint@csgs.comwrites:
Quote:
Originally Posted by
Hello, is Unicode part of C/C++? I have some unicode data, and I need to
get some kind of ASCii C string from it. Is that possible?


A very popular Unicode libary is IBM's ICU:

<http://www.icu-project.org/>

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
 
Not the answer you were looking for? Post your question . . .
197,050 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,050 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors