Murray Cumming wrote:
On Sat, 2008-07-12 at 19:15 -0700, Sohail Somani wrote:Yes, you are right. Copying the ustring to a std::string gets rid of the error but still doesn't work right because it is interpreted as ASCII in the console.std::cout does not understand UTF-8. That's why glibmm tries to do a conversion (with the Glib::convert_*() functions. That's documented by the way: http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1ustring.html#_details But I don't know why the conversion is failing in your case. Maybe it's a problem with the glib installation on windows.
Ok, I've figured out the cause of the problem.operator<< calls the g_convert function with from_codeset = "UTF-8" and to_codeset = "CP1252".
Obviously, only some characters can be translated from UTF-8 to code page 1252 which is some European code page. So when glib calls the underlying Windows API conversion function, it correctly barfs.
If anyone is a Windows guru (quite possibly the wrong list to ask this question!), I'd appreciate an idea of how I can set my code page so I can still have an English desktop but can convert to/from UTF-8 in a lossless manner.
Thanks for your help. Sohail