这里plain string
有一种编码:
一个普通的字符串文字,例如
"plainstring"
编码为;所有标准库都返回或接受。例如:</p>
std::cout << "I'm ok." ; // plain string, ok on my system,
// VS2015 x64 default encoding setting.
std::cout << u8"I'm wrong."; // got error display on my system
std::experimental::filesystem::path path("Some Right specified Path contains non-ASCII chars"); // ok
std::experimental::filesystem::path path2(u8"Some Path specified Path contains non-ASCII chars"); // error
std::experimental::filesystem::directory_iterator r(path); // ok
std::experimental::filesystem::directory_iterator r2(path2); // will throw exception
据我所知,我的系统(Windows 10 x64)GB2312
对这种纯字符串使用编码。
但是如何将它们转换为(并转换回)其他编码,例如以utf-8
独立于平台的方式?