Re: std::cout << Glib::ustring(utf8_literal) throws exception



It should be noted here that Glib::ustring::operator<< performs a conversion from UTF-8 to the currenty set locale (yeah it's weird and unexpected) and thus works intransparent and produces sideeffects; i don't know the implication of this on Windows but i'm willing to be that that's the reason for your problem here. You could try copying the ustring to an std::string before using << and then feed the std::string to cout.

2008/7/13 Sohail Somani <sohail taggedtype net>:
Hi,

The following code works fine on Linux but dies on Windows when run in the console:

#include <gtkmm.h>

int main()
{
 setlocale(LC_ALL,0);
 // Should output aleph
 std::cout << Glib::ustring("\xd7\x90") << std::endl
}

The error is: "Invalid byte sequence in conversion input"

Has anyone tried UTF-8 with Glib on Windows? What else do I need to do?

Thanks,

Sohail

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



--
------------
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]

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