Why is std::setw() considering special chars as two chars ? Is there any easy and stylish way to solve this ?
Eg :
#include <iostream>
#include <iomanip>
int main()
{
std::cout << std::left << std::setw(10) << "ok" << "ok" << std::endl;
std::cout << std::left << std::setw(10) << "test.." << "ok again" << std::endl;
std::cout << std::left << std::setw(10) << "®èé" << "fail" << std::endl;
return 0;
}
Ouputs :
ok ok
test.. ok again
®èé fail
Here is the live test : http://ideone.com/q57I0H