Boost logo

Boost :

Subject: Re: [boost] Program Options library and Unicode compliance
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2013-09-30 01:46:37


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.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk