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

Luca Manganelli luca76 at gmail.com
Tue Dec 29 15:40:05 CET 2009


On Tue, Dec 29, 2009 at 15:31, Robert Hairgrove <evorgriahr at hispeed.ch> wrote:
>> 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?
>
> I believe you need to set the encoding either in the ODBC datasource or
> in the Client Access connection properties. If you can connect to the
> DSN with some other application, can you see the data presented
> normally? If so, it should work with QtSql as well.

This is the stranger thing. If I use the normal ODBC python module,
the data are represented correctely. Only with QtSql module I have
these problems.




More information about the Qt-interest-old mailing list