2

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

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

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

KyleL
  • 733
  • 5
  • 21
Mugunth
  • 2,228
  • 1
  • 21
  • 28

3 Answers3

7

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
  • 811,175
  • 162
  • 1,198
  • 1,373
0
cout << (int)c 

that's it

Andrey
  • 57,904
  • 11
  • 115
  • 158
0
void print_decimal(wchar_t character)
{
  std::cout << int(character);
}
sbi
  • 212,637
  • 45
  • 247
  • 432