On Sun, 14 Dec 2008 23:51:09 +0400 Alexander Shaduri <ashaduri@xxxxxxxxx> wrote: > > Hi all, > > I'm getting an error when using g_locale_from_utf8() > under win2000 (doesn't happen in XP or Vista). > > With a locale of "English_United States.1252", for: > --------------------------------------------------------- > GError* error = 0; > gsize written = 0; > g_locale_from_utf8("hello", 5, NULL, &written, &error); > --------------------------------------------------------- > > I get: > --------------------------------------------------------- > Invalid byte sequence in conversion input > --------------------------------------------------------- > in error->message. > > A simple test case is attached. > > This gets especially annoying when using Glibmm, > where a simple > std::cout << Glib::ustring("abc"); > triggers a conversion error exception (it calls the > g_locale_from_utf8() function), and the program dies > all over the place due to unhandled exceptions. > > The gtk/glib/dependencies come from > http://ftp.gnome.org/pub/gnome/binaries/win32/ Does it work if you call setlocale(LC_ALL,"") (or with glibmm, std::locale::global(std::locale("") ) before you attempt any conversions? If not, it looks as if your editor is writing the string literal into your code in a codeset which represents the characters "hello" differently than UTF-8/ASCII does (g_locale_from_utf8() has to be passed valid UTF-8). Chris _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list