I try to parse text and find some characters in it. I use the code below. It works with normal characters like abcdef
but it does not work with öçşğüı
The best way to handle wide characters is as, well, wide characters.
wchar_t myWord[] = L"Something";
This will do it:
#include
#include
#include
int main()
{
wchar_t * text = L"öçşğü";
int i = 0;
while (text[i])
{
if (text[i] == L'ö')
{
wprintf(L"ö \n");
}
i++;
}
return 0;
}
If you're in Visual Studio, like me, recall that the console window doesn't handle Unicode well. You can redirect it to a file and examine the file, and see the ö
.