Boost logo

Boost :

Subject: Re: [boost] [nowide] Library Updates and Boost's broken UTF-8 codecvt facet
From: Peter Dimov (lists_at_[hidden])
Date: 2015-10-09 09:32:10


Artyom Beilis wrote:

> > bool is_valid_utf8( string const & s );
> > wstring utf8_decode( string const & s );
> > string utf8_encode( wstring const & s );
>
> See, all this is already implemented in header only way in Boost.Locale -
> so no linking required.
>
> https://github.com/boostorg/locale/blob/master/include/boost/locale/utf.hpp
> https://github.com/boostorg/locale/blob/master/include/boost/locale/encoding_utf.hpp
>
> So just call boost::locale::conv::utf_to_utf<wchar_t>("Hello World");

That's nice.

I'd prefer UTF-8 support to not be tied to locales as it's more fundamental,
but you have basically anticipated that and made Nowide, which is exactly
what I need on a day-to-day basis - support for UTF-8 as the ubiquitous
external encoding. Nowide however spells those functions in a different way,
nowide::widen and nowide::narrow.

One issue is that these functions are not immediately discoverable, in
either place. One would expect UTF-8 functions to be in a library having
UTF-8 in the name, or for the functions to have utf8 in their names.


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