Re: std::cout << Glib::ustring(utf8_literal) throws exception
- From: Sohail Somani <sohail taggedtype net>
- To: gtkmm-list gnome org
- Subject: Re: std::cout << Glib::ustring(utf8_literal) throws exception
- Date: Sun, 13 Jul 2008 14:54:38 -0700
Chris Vine wrote:
On Sun, 13 Jul 2008 10:01:02 -0700
Sohail Somani <sohail taggedtype net> wrote:
But yes, I need to figure out why the conversion is failing in the
first place rather than trying these hacks (ustring -> std::string).
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.
Incidentally, you don't need to make a std::string object, you can
access the one in the Glib::ustring object with Glib::ustring::raw().
(However, there was no need to use a Glib::ustring object at all in the
example you originally gave, but probably it was just a cut-down
example of something else.)
I'll go with cut-down example :-)
Thanks.
Sohail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]