tags:

views:

189

answers:

3

I have got two questions.

1 - I get Unicode code-points and how do I get the character associated with this code-point? Something like:

int code_point = 0xD24;
char* chr = (char*) code_point;

But the above code fails by throwing exception.

2 - Suppose the code-point is stored in a file and I read the code-point to a string, how do I convert that to valid Unicode string?

I am looking for a platform independent solution. Any help would be great!

+3  A: 

Have you looked at the International Components for Unicode project? As per the site,

ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. ICU is widely portable and gives applications the same results on all platforms and between C/C++ and Java software.

Vijay Mathew
+2  A: 

Don't you mean to be assigning that value to a char (or more precisely, to a wchar_t), not a char* ?

John Lockwood
A: 

Are you looking for the name of the character? u_charName() in ICU will do this, returning something like LATIN SMALL LETTER A.

Steven R. Loomis