我在string_algo包中的函数遇到了问题。
看一下这段代码:
#include <boost/algorithm/string.hpp>
int main() {
try{
string s = "meißen";
locale l("de_DE.UTF-8");
to_upper(s, l);
cout << s << endl;
catch(std::runtime_error& e){
cerr << e.what() << endl;
}
try{
string s = "composición";
locale l("es_CO.UTF-8");
to_upper(s, l);
cout << s << endl;
catch(std::runtime_error& e){
cerr << e.what() << endl;
}
}
这段代码的预期输出应该是:
MEISSEN
COMPOSICIÓN
然而,我得到的唯一的东西是:
MEIßEN
COMPOSICIóN
很明显地,区域设置没有被考虑进去。我甚至尝试设置全局区域设置也没有成功。我该怎么办?