Re: Glib::ustring's operator<< doing a conversion to locale, why?



On Thu, 2007-05-03 at 23:54 +0200, Milosz Derezynski wrote:
> I found that Glib::ustring::operator<<() does a locale-from-utf8
> conversion, always, and all the time. This totally, erm, avoiding foul
> language, spoils up usage of e.g. boost::format properly, if i want to
> have the UTF8-ness preserved.

Yes, this is documented here:
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1ustring.html#_details

I believe that this must be done because the C++ ostream cannot deal
with UTF-8. I don't know whether boost::format can deal with UTF-8 -
possibly not.

People have complained often before, but the problems seems to remain in
C++ ostream itself.

> Using .c_str() or .raw() will avoid this problem, but this is hardly a
> solution (now i'd have to audit _all_ of our code). Adding to this
> comes that an ostream will probably perform a conversion to whatever
> locale it's imbued with anyway, so why this conversion there? 
> 
> It seems to be just simply and plain flawed to me, unless i'm totally
> wrong, in which case i'd be glad to accept a justification of the
> issue.
> 
> -- Milosz
> "'Cause if an actor acts in the forest and there's nobody there to see
> him...... Or something like that." -- Terry O'Ryan 

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]