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

Bill King bill.king at nokia.com
Tue Jan 5 00:38:34 CET 2010


On 12/30/2009 12:40 AM, ext Luca Manganelli wrote:
> 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.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   
According to
http://www-03.ibm.com/systems/i/software/access/linux/guide/index.html#nls,
your current charachter set is defined by your system. You may need to
check/set your system locale, as that may be affecting things. Note: Qt
does no translation of the string supplied to it by odbc, so wysiwg.

-- 
Bill King, Software Engineer
Qt Development Frameworks, Nokia Pty Ltd
Brisbane Office

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100105/cd437f28/attachment.html 


More information about the Qt-interest-old mailing list