I can print sinhala words to the console. But can't print letter by letter!
This prints the word correctly to the console:
But the below code doesn't print characters correctly.
I get the following output from the above code.
My goal is to read a text file that has a large number of sinhala words and convert them to equivalent phonetic english words. For this, I need to compare letters in the sinhala unicode word. So that means I need a way to read letter by letter.
I know a very little about Unicode stuff. So any tip/advice would be much appreciated!
This prints the word correctly to the console:
Code:
char *word = "අලංකෘත";
// print the word
printf("%s\n",word);
But the below code doesn't print characters correctly.
Code:
char *word = "අලංකෘත";
// print letter by letter
int n = sizeof(word) / sizeof(word[0]);
for (int i = 0; i < n; i++) {
printf("%c\n", word[i]);
}
I get the following output from the above code.
Code:
\340
\266
\205
\340
\266
\275
\340
\266
My goal is to read a text file that has a large number of sinhala words and convert them to equivalent phonetic english words. For this, I need to compare letters in the sinhala unicode word. So that means I need a way to read letter by letter.
I know a very little about Unicode stuff. So any tip/advice would be much appreciated!