Re: Problems on Displaying some characters in a Gtk::TreeView



On Thu, 05 Feb 2009 12:47:52 +0000
Filipe Apostolo <f apostolo cbr gmail com> wrote:

> Hi to everybody,
> 
> Well I'm facing a strange problem when I try to display some special
> character of the ascii table.
> 
> For example if I want to display character 3 of the table  (the
> heart) it will  not be displayed the heart . Instead it will be an
> Default symbol (I call it default because it appears in all
> unreconized symbols.
> 
> First I though that it was some conversion problem but then I tested
> and it is not that at all.
> 
> Well as an small example i done something  like this:
> 
> "Here I use std::string just to test all conversions".
> 
> 
> std::string str;
> char testeCh = 3;
> str = testeCh;
> std::cout << "STRING " << str << std::endl;
> The output in the console window is the heart has I want.
> 
> Then I call a function that receives the  A Glib::ustring as
> parameter. And will set that parameter int the treeview with some
> others parameters.
> 
> mMyTreeview.InsertItemValue (itemRowIterator, timestampStr, str);
> /////////////////////////////////////////
> The Function is described here:
> 
>  void MyTreeView::InsertItemValue (const Gtk::TreeModel::iterator
> row_it, const Glib::ustring &timestamp,
>                          const Glib::ustring &value)
> {
>   Gtk::TreeModel::Row row = *row_it;
> 
>  std::cout << "USTRING: " << value << "; Ustring.c_str(): " <<
> value.c_str () <<    std::endl; 
> row[mListColumnsModel.Value] = value.c_str();
>   
>  std::cout << "ROW Value: " << row[mListColumnsModel.Value] <<
> std::endl; 
>  row[mListColumnsModel.Timestamp] = timestamp;  
> }
> 
> The Output of Ustring and Row value in the console is the Heart
> symbol but in the Gtk::treeview value field is a strange symbol that
> appears in the other special ascii  symbols like the arrows, happy
> faces ond so one;
> 
> Could any one now what is missing in my code, or why is this appening

It is probably happening because a byte with value 3 is not valid UTF-8.

Chris



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