I'm writing a program in C++ which have to handle unicode characters. The main problem is I use algorithms where I need to parse my s/wstrings char by char :
std::wstring word = L"Héllo"
for (auto &e : word)
// doing something with e
But if I run this :
std::wstring word = L"Héllo"
for (auto &e : word)
std::wcout << e << std::endl;
I get this output :
H
?
l
l
o
Am I doing something wrong ?
Do note that word
prints properly when I use std::wcout << word;
.
EDIT FOR @Ben Voigt
Here is the out with std::wcout << std::hex << std::setw(4) << (int)e << L" " << e << L'\n';
:
48 H
e9 �
6c l
6c l
6f o