On Sat, 10 Sep 2011 23:51:21 +0200
Milosz Derezynski <internaler...@gmail.com> wrote:
> Here we are, 2011, and Glib::ustring::operator<< is haunting us still.
> 
> I'm a little bit tired and my advice may seem counterproductive, but
> just so you know, this is a very old issue, and in actuality is not
> related to the fact that you "have to store UTF-8 strings only in
> Glib::ustring"; it's a problem.

It is related to that.  If the stored text is not in UTF-8 then
operator<<() will throw, because the attempted conversion from UTF-8
to the locale encoding will fail.

I agree with your general sentiment, and Daniel Elstner has said a
number of times that in hindsight the conversion carried out by the
operator<<() overload for Glib::ustring was a mistake.  But it is a
mistake a coder generally only makes once and she soon gets used to
calling Glib::ustring::raw() when using ostreams.  It is pointless now
breaking API on this.

I find myself using Glib::ustring increasingly less often.  I find that
std::string in combination with the glibmm supplied UTF-8 iterator for
std::string (or my own slightly different version of it) does the job
well enough in most cases.

Chris


_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to