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



Chris Vine wrote:
On Sun, 13 Jul 2008 14:54:38 -0700
Sohail Somani <sohail taggedtype net> wrote:
Chris Vine wrote:
Conversions can fail for various reasons, but to start from the
beginning have you set a locale of any kind which handles non-ascii
characters?  In particular, have you called setlocale(LC_ALL,""),
or the equivalent std::locale::global(std::locale(""))?  If you
have not, the C locale will be used and any glibmm conversion will
throw an exception if a byte of value >= 128 is met.
Yes, I have tried both.

Possibly then your machine locale cannot handle the characters that you
are trying to feed to it (unless a narrow character codeset is UTF-8 it
is probably limited to around 200 different characters). If setting
your machine locale to UTF-8 works, that is most likely the reason.

Great, I thought this was exactly the problem as well! Now, do you know how I can set Windows XP to have a locale of "UTF-8"? I can't figure it out nor can I convince Professor Google to let me cheat on the test :-(

Sohail



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