codecvt

Stumped with Unicode, Boost, C++, codecvts

社会主义新天地 提交于 2019-11-30 02:08:41
In C++, I want to use Unicode to do things. So after falling down the rabbit hole of Unicode, I've managed to end up in a train wreck of confusion, headaches and locales. But in Boost I've had the unfortunate problem of trying to use Unicode file paths and trying to use the Boost program options library with Unicode input. I've read whatever I could find on the subjects of locales, codecvts, Unicode encodings and Boost. My current attempt to get things to work is to have a codecvt that takes a UTF-8 string and converts it to the platform's encoding (UTF-8 on POSIX, UTF-16 on Windows), I've

Stumped with Unicode, Boost, C++, codecvts

。_饼干妹妹 提交于 2019-11-28 23:42:37
问题 In C++, I want to use Unicode to do things. So after falling down the rabbit hole of Unicode, I've managed to end up in a train wreck of confusion, headaches and locales. But in Boost I've had the unfortunate problem of trying to use Unicode file paths and trying to use the Boost program options library with Unicode input. I've read whatever I could find on the subjects of locales, codecvts, Unicode encodings and Boost. My current attempt to get things to work is to have a codecvt that takes

Deprecated header <codecvt> replacement

戏子无情 提交于 2019-11-26 05:29:40
问题 A bit of foreground: my task required converting UTF-8 XML file to UTF-16 (with proper header, of course). And so I searched about usual ways of converting UTF-8 to UTF-16, and found out that one should use templates from <codecvt> . But now when it is deprecated, I wonder what is the new common way of doing the same task? (Don\'t mind using Boost at all, but other than that I prefer to stay as close to standard library as possible.) 回答1: std::codecvt template from <locale> itself isn't