tags:

views:

105

answers:

3

For one of my opensource project, i need to compute decimal equivalent of given unicode character.

For example if tamil character L'அ' given, output should be 2949 .

I am using c++ in Qt environment. I googled and couldnot find a solution for this. Pls help if you know a solution for this.

+6  A: 

Use the unicode() method of the QChar object (which you can get e.g. with the at method of a QString, if a QString is what you have to start with).

Alex Martelli
Thanks a lot. unicode() method of QChar gave the required result.
Mugunth
A: 
cout << (int)c 

that's it

Andrey
I also tried this before posting. But it dont worked for unicode characters.
Mugunth
A: 
void print_decimal(wchar_t character)
{
  std::cout << int(character);
}
sbi