0

How to make function that convert from UTF8 Cyrillic to UTF8 Latin characters? I know that I should make character table, but my main problem is how to represent string (in C ,Linux OS)? As char* or int* ( due to size of UTF8 )?

void convert(unsigned char* str) {
    if(str[0] == 'A' ) str[0] = 0xd090; // Cyrillic A
    ...
}
viktor.radovic
  • 508
  • 2
  • 9
  • 20

1 Answers1

1

You can't replace a char with an int (or short), as it won't fit in a char. Either read the latin characters into a wchar_t array, or use a separate output array for the Cyrillic characters.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621