[Qt-interest] Question about QSqlDatabase, AS/400 and encoding / charset

Luca Manganelli luca76 at gmail.com
Tue Dec 29 11:26:22 CET 2009


Hi,

I'm using PyQT4 4.5.1.

I use QSqlDatabase to connect with the AS/400 IBM Client Access ODBC driver.

I use QSqlQueryModel to represent a query to a QTableView.

My problem is that the data in the QTableView are represented in
EDBCIC format, while I want them in utf8 format.

The code listing follows:

        conn = QSqlDatabase().addDatabase("QODBC")
        conn.setDatabaseName("DBNAME")
        conn.setUserName("...")
        conn.setPassword("...")
        cur = QSqlQueryModel ()
        cur.setQuery ("SELECT * FROM IMMOBCATAS WHERE convert(varchar,
collationproperty(name, 'CodePage')) = '870'", conn)

How can I set encoding in QSqlDatabase?



More information about the Qt-interest-old mailing list