Nice, but this only works if GLIBMM_HAVE_WIDE_STREAM is defined.

PS: My Gtkmm Windows installation don't have this defined.

2009/4/28 Daniel Elstner <[email protected]>

> Hi,
>
> Am Dienstag, den 28.04.2009, 08:31 -0300 schrieb Fabrício Godoy:
> > I don't think that Glib::convert can convert (or convert well)
> > wstrings.
> > My sugestion:
> >
> > // #include <glib.h>
> > std::wstring mywstr(L"any text");
> > gchar* pt_ustr = g_utf16_to_utf8((gunichar2*)mywstr.c_str(), -1, NULL,
> > NULL, NULL);
> > Glib::ustring myustr(pt_ustr);
> > g_free(pt_ustr);
>
> How about this:
>
>    std::wstring wstr = L"foo";
>    Glib::ustring ustr = Glib::ustring::format(wstr);
>
> :-D
>
> I know, I know, it's not exactly obvious.  But nonetheless a nice side
> effect of the fact that ustring::format() is based on wide streams.  And
> yes, you can rely on this on any platform that supports wide streams at
> all.
>
> --Daniel
>
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to