Re: No yet encrypted...



2011-12-05 21:04, Chris Vine skrev:
On Mon, 5 Dec 2011 18:27:43 +0100
Glus Xof<gtglus gmail com>  wrote:

The problem, here, is that this code works fine with one-byte
characters string but breaks with multi-byte characters strings !
It would help if you said what "breaks" means.  Do you mean it
throws a conversion exception?   If so then:

  std::cout<<  Glib::ustring::compose("# %1", mess).raw()
            <<  std::endl;
Thanks, was that... !
You have found the problem, but as I said in my original problem this is
a diagnostic and not the fix. You should not put text into a
Glib::ustring object which is not in utf-8 encoding.  Use a std::string
object instead and don't use the ustring composing functions.

Chris

Isn't the problem here that r_mess and mess _are_ utf-8 encoded, but operator<<(std::ostream&, const Glib::ustring&) can't convert to the encoding used for printing? You may find some useful information in bug 661588, https://bugzilla.gnome.org/show_bug.cgi?id=661588.

And I agree with Chris Vine that you should have been more specific. "The program throws a Glib::ConvertError exception with message BlaBlaBla" is much more informative than "The program breaks."

Kjell



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