If I read special characters from a file and then try to compare them (like with an if) it doesn't recognize them.
std::wstring c;
std::wifstream file;
file.open("test.txt");
while (file)
{
wchar_t tmp = file.get();
c += tmp;
}
file.close();
size_t l = c.length();
for (int i = 0; i < l; i++)
{
wchar_t a = c[i];
if (a == L'ä') {
std::cout << "if triggered.";
}
}
But when I create a wchar and predefine a special character it does work.
wchar_t a = L'ä';
if (a == L'ä') {
std::cout << "if triggered";
}
and if I put the wstring that was loaded from the file, in the file I get the text back. Nothing weird happens there.