PDA

View Full Version : Import PostgreSQL Values to QT



raphaelf
16th May 2007, 13:37
Hello everybody,

I have a PostreSQL Database. I am able to import values to a listView for example.
My problem is:
I have in a table a value like this: "lächerlich" .
I get in my listview l[]cherlich

How could i get the exactly value on qt?



QSqlQuery select("select language1, plural, language2, description from words_tbl order by language1");
while(select.next())
{
QString language1 = select.value(0).toString();
...



Thanks

wysota
16th May 2007, 14:35
You have to use a proper text codec either in the database or in your app (or both).

raphaelf
16th May 2007, 15:10
Hallo Wysota,

Under Postre i am using text datatype and on qt QString..

Where could i found a example for my problem?
I dont have understand exactly how to implement this..:crying:

wysota
16th May 2007, 17:37
www.postgresql.org probably... You have to be aware which encoding the database uses and use the same to fetch data into QString.

jacek
16th May 2007, 21:13
Qt talks to the PostgreSQL in Unicode, so it should work out of the box. How did you fill the database with data?

wysota
16th May 2007, 21:37
Qt talks to the PostgreSQL in Unicode, so it should work out of the box.

Unless the database doesn't contain data in Unicode (or at least in the encoding specified by the database).

raphaelf
23rd May 2007, 08:03
Hi everybody,

If i write a value direct on PGAdmin i can see extrange values on QT, but if i fill the database on QT it works fine..

My idea is to fill data from qt, so thats ok..

Thank you all :D

wysota
23rd May 2007, 09:03
It probably means the database contents uses a different encoding than declared in the database.

zlatko
23rd May 2007, 09:09
Try check client_encoding in postgresql.conf