$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Fw: [locale] Formal review of Boost.Locale library
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2011-04-14 17:33:51
14.04.2011 23:29, Artyom пиÑеÑ:
>>
>
>>> Does this library support this conversion? No.
>>> Why it  doesn't support char set conversion between UTFs?
>>
>> Agree. I see no way to  convert strings between UTF-X and UTF-Y without
>> specifying the locale.
> Actually there is:
>     std::wstring w=boost::locale::conf::to_utf<wchar_t>("some text","UTF-8");
>     std::string n=boost::locale::conf::to_utf<char>(L"some text","UTF-8");
It seems to me that this method has non-zero overhead:
1. The "UTF-8" charset string is passed to the to_utf() as std::string 
const &.
2. The wconv_to_utf object is created on the heap, initialized with 
open() and used to convert the string. Btw, why don't you create it on 
the stack?
3. When initializing, the wconv_to_utf object tries to normalize the 
charset (one more string allocation) and then to find it in the 
supported charsets table.
4. Finally, the 65001 codepage is passed to the MultiByteToWideChar. The 
MultiByteToWideChar() probably has it's own overhead related to finding 
the appropriate converter for the specified codepage.
I think we need something more lightweight.
-- Sergey Cheban