Tux-Slack
10th July 2007, 13:50
Hello everyone!
I'm developing a small app witch contains a list view and then saves it to the disk and loads it back.
Everything works just fine, until I put non-standard ASCII chars into the list, like Å¡čžćđ.
If I go ahead and just save that string like it is, i get ?(question marks) all over instead of the inputed chars.
If I change the string wiht QString::local8Bit() function then it saves right.
The problem is, when I try to load the file back. The chars load good into a QString. So if in a file there is Å¡čćžđ then there's going to be the same in the QString to witch I load it.
The problem is when I add this QString to the list view. Then I get these chars:
Å¡ÄÂÂƾ
Now I've ran out of ideas, and don't know what could I do next.
This is how I add it to the list view:
{
QString Num;
QPixmap icon;
icon = setItemIcon(Tip, Lastnistvo);
QListViewItem * item = new QListViewItem( listView1, 0 );
if ( zap_st == -1 )
item->setText( 0, Num.setNum( itemCount ) );
else
item->setText( 0, Num.setNum( zap_st ) );
item->setText( 1, Naslov );
item->setPixmap( 1, icon );
dataChange = 1;
StatusBar->message( tr( "\"%1\" added to list").arg(Naslov), 2000 );
}
I'm developing a small app witch contains a list view and then saves it to the disk and loads it back.
Everything works just fine, until I put non-standard ASCII chars into the list, like Å¡čžćđ.
If I go ahead and just save that string like it is, i get ?(question marks) all over instead of the inputed chars.
If I change the string wiht QString::local8Bit() function then it saves right.
The problem is, when I try to load the file back. The chars load good into a QString. So if in a file there is Å¡čćžđ then there's going to be the same in the QString to witch I load it.
The problem is when I add this QString to the list view. Then I get these chars:
Å¡ÄÂÂƾ
Now I've ran out of ideas, and don't know what could I do next.
This is how I add it to the list view:
{
QString Num;
QPixmap icon;
icon = setItemIcon(Tip, Lastnistvo);
QListViewItem * item = new QListViewItem( listView1, 0 );
if ( zap_st == -1 )
item->setText( 0, Num.setNum( itemCount ) );
else
item->setText( 0, Num.setNum( zap_st ) );
item->setText( 1, Naslov );
item->setPixmap( 1, icon );
dataChange = 1;
StatusBar->message( tr( "\"%1\" added to list").arg(Naslov), 2000 );
}