cout << setw doesn't align correctly with åäö
问题 The following code reproduces my problem: #include <iostream> #include <iomanip> #include <string> void p(std::string s, int w) { std::cout << std::left << std::setw(w) << s; } int main(int argc, char const *argv[]) { p("COL_A", 7); p("COL_B", 7); p("COL_C", 5); std::cout << std::endl; p("ABC", 7); p("ÅÄÖ", 7); p("ABC", 5); std::cout << std::endl; return 0; } This produces the following output: COL_A COL_B COL_C ABC ÅÄÖ ABC If i change "ÅÄÖ" in the code to e.g. "ABC", then it works: COL_A COL