Re: ustring bug?



Yes, the correct type to pass to Glib::locale_to_utf8() is a std::string, rather than Glib::ustring which expects its contents to already be valid UTF-8 bytes, something that locale-encoded characters outside of 7-bit ASCII are not. Also worth noting, you'll find that if your program uses Gtk, that once that has been initialized (by constructing a Gtk::Main), the locale stuff will be set up automatically - and not just setlocale(), also things like textdomain(), which helps if your program has translatable strings (marked with _("...") ). Letting Gtk do it also helps hide platform differences (Windows' setlocale() for example works slightly differently.)
Hope that helps.



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