I am using std::iswalpha
to check if a non-ASCII character (French character) is alphabetic. However, I have found that it returns false
for é
character. I have set my locale to fr_FR.UTF-8
in my code. Can you help me understand why this is happening and how I can correctly determine whether a French character is alphabetic using C++?
#include <iostream>
#include <cwctype>
int main() {
std::setlocale(LC_ALL, "fr_FR.UTF-8");
wchar_t ch = L'é';
bool is_alpha = std::iswalpha(ch);
std::cout << is_alpha << std::endl; // print 0
return 0;
}