I have a wide character string (std :: wstring) in my code, and I need to look for a wide character in it.
I use the find () function for it:
wcin >> str;
wcout << ((str.find(L'') != wstring::npos)? L"EXIST":L"NONE");
L'' is a cyrillic letter.
But find () in the same call always returns npos. In the case of Latin letters, find () works correctly.
Is this a problem with this feature? Or did I do something wrong?
UPD
I use MinGW and save the source code in UTF-8. I also set the locale to setlocale(LC_ALL, "");. The same code wcout << L'';works together. But the same
wchar_t w;
wcin >> w;
wcout << w;
it works incorrectly.
This is strange. I had no coding problems before using setlocale ().
source
share