Program Options library and Unicode compliance
I noticed that the class option_description does not work with wstring, instead works with string. Does anyone has any idea why is it so? Regards, Manish -- May the force be with you
On 9/25/2013 6:29 PM, Quoth munsingh:
I noticed that the class option_description does not work with wstring, instead works with string.
Does anyone has any idea why is it so?
I'm just guessing, but most likely because it grew from Unixy roots, and UCS-16/32 is rarer there. (And because not everyone agrees on how wide a wchar_t is, while at least most implementations agree on char.) Also probably because it's simpler to have the help text sent directly to std::cout rather than having to support two different option_description implementations or two separate description fields (what should it do if you populate both?). And simpler if your translation code only has to worry about one path too. Since you should be filling this in with text in the user's language anyway, it should be safe to convert whatever you have to the 8-bit locale before giving it to option_description. (And the user should have set their 8-bit locale to UTF-8 or another multibyte encoding if their language cannot otherwise be expressed in an 8-bit character set.)
participants (2)
-
Gavin Lambert
-
munsingh