The conversions done by Glib::ustring are
reasonable, at least if the read or written stream uses the
global locale. A std::locale contains a
codecvt facet, used for converting between one character
encoding in the stream (file) and a possibly different character
encoding in main memory. But Glib::ustring shall always contain
UTF-8 encoded characters, independent of the stream's locale and
codecvt facet. It's reasonable that ustring's operator<<()
and operator>>() convert between UTF-8 and the stream's
main memory encoding.
The drawback with the present version of ustring is that it converts between UTF-8 and the encoding of the global locale, even if the stream uses another locale, set with std::ios_base::imbue(). I don't know if this can be improved with a reasonable effort. Kjell |