Re: utf-8 and TextView usage



ZeeGeek <zeegeek gmail com> writes:

> I've checked the reference that textbuffer->get_text(0) returns a UTF-8 
> string, so I used a ustring variable to carry the returned value, however it 
> didn't print out chinese when I cout the value of the variable in gnome 
> terminal. Then I tried to declare the variable as a std::string, and chinese 
> showed up in the terminal. Can anyone tell me why it didn't work why the 
> variable was declared as a ustring?

Glib::ustring will automatically convert the string to use the
encoding of locale if you std::cout it, if I recall correctly. So
probably the UTF-8 string gets converted to something non-UTF-8 (try
running "locale" in the terminal to see what, it might be a bad
configuration) which gnome-terminal is then confused by. Try piping
the output to a file and open it with Emacs or gedit instead.

-- 
Ole Laursen
http://www.cs.aau.dk/~olau/



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