Boost logo

Boost :

Subject: Re: [boost] [general] What will string handling in C++ look like in the future [was Always treat ... ]
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2011-01-21 02:26:35


On 01/20/2011 07:43 AM, Alexander Lamaison wrote:
>
> I imagine you wouldn't have UTF-16 and UTF-32 string being passed about as
> a matter for course. For instance, a UTF-16 string should only be used
> just before calling a Windows API call.
>
> If this is the case, it makes sense to make the common case (UTF-8 string)
> have a nice name like boost::string and the others which are used for
> special situations can have something less snappy like boost::u16string and
> boost::u32string.
What would you use for a regular string where you just had, essentially
a vector of char, wchar_t, char8_t, char16_t, char32_t, or unsigned
char, but didn't care about encoding? I want to differentiate between
this case and the case where I know that there's a particular encoding.
A lot of times you just know you got a string from one system call and
you're passing it to another and you don't care about encoding. If you
used a validating utf8 std::string, if it turned out not to be utf-8
you'd throw or return an error for nothing. It's not a good fit for
existing things, it would just be something going forward for things
that knew that they were using utf-8.

Patrick


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