Re: [gtkmm] converting iso-8859-1 to Glib::ustring



On Wed, Jul 02, 2003 at 09:12:46AM -0400, joey yandle wrote:
> Hi everyone,
> 
> After reading through the tutorial and the glibmm docs, I'm still unsure how
> to go about converting non-ascii strings to utf8.  Let's say I have
> the following:
> 
> std::string iso("\xf1");  // iso-8859-1 encoding: n+tilde
> 
> How do I make this into a Glib::ustring?  
> 
>   Glib::locale_to_utf8(iso);

What does:
  std::string charset;
  bool utf8 = Glib::get_charset(charset);
  std::cout << charset << ( utf8 ? " (utf8) : "") << std::endl;

output?

>   Glib::convert(iso, "", "iso-8859-1");

Have you tried:
Glib::convert(iso, "UTF-8", "ISO-8859-1");

?

Barnaby



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