Boost logo

Boost Users :

Subject: Re: [Boost-users] UTF-16
From: plarroy (plarroy_at_[hidden])
Date: 2009-07-24 06:07:43


Yes, but you can easily count codepoints using ICU if you need this feature.

I choosed not leverage that with std::string.

Regards.

Robert Dailey wrote:
> Problem with that is that std::string::length() no longer provides a
> meaningful value. It will count each byte is 1 character.
>
> ---------
> Robert Dailey
>
>
> On Thu, Jul 16, 2009 at 3:39 AM, plarroy <plarroy_at_[hidden]> wrote:
>
>
>> Hi
>>
>> My approach is using std::string, etc. all the time and using UTF-8
>> internally, only converting to other charsets when it's needed.
>>
>> I use IBM icu library and made a boost::iostreams filter to convert
>> encoding, once it's done takes a lot of complexity away, I use it like:
>>
>>
>> // setup a conversion from charset to utf-8
>> filt_streamb.push(ucnv_filter(charset.c_str(), "utf-8"));
>> istream is(&filt_streamb);
>>
>> Perhaps there's interest to push this charset conversion into
>> boost::iostreams filters examples.
>>
>>
>> Regards.
>>
>> Robert Dailey wrote:
>>
>>
>>> Oh, I also forgot to mention, I am also using boost::filesystem::path. I
>>> guess this means I need to use wchar_t everywhere (std::wstring,
>>> boost::filesystem::wpath, etc) and just let wxWidgets do the
>>> encoding/decoding? If I don't have to do any encoding/decoding myself,
>>> then
>>> there really is no need for a special object. But just in case I would
>>> like
>>> to have the encoding/decoding abilities.
>>>
>>> On Sun, Jun 14, 2009 at 12:27 PM, Robert Dailey <rcdailey_at_[hidden]>
>>> wrote:
>>>
>>>
>>>
>>>
>>>> Hi everyone,
>>>> I did a bit of googling to see if Boost 1.39 as any portable support for
>>>> UTF-16 encoded strings, but I did not find any. I'm currently using
>>>> wxWidgets in my application, and I need a decent string object to use. I
>>>> know that wxWidgets has UTF-16 string support through wxString, however I
>>>> do
>>>> not want to expose this object in my interfaces. I want to remain as
>>>> abstracted away from wxWidgets as possible. Having said that, if someone
>>>> could tell me if there is any existing UTF-16 string support in Boost,
>>>> I'd
>>>> appreciate it. I did not find anything in the vault, sandbox, or trunk in
>>>> Boost.
>>>>
>>>> If boost has no such string object, could someone give me a head start on
>>>> where to look? Thanks.
>>>>
>>>>
>>>>
>>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Boost-users mailing list
>>> Boost-users_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>>
>>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net