My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 262: query result ???????
1 person starred this issue and may be notified of changes. Back to list
Status:  Hold
Owner:  ----


 
Reported by kathawu...@gmail.com, May 15, 2012
What steps will reproduce the problem?
1.Connect to a SQL SERVER 2005 Database 
2.My code is below:
        cnxn = pyodbc.connect('DSN=winspeed2;CHARSET=UTF8LANGUAGE=th_TH')
        cursor = cnxn.cursor()
        #CustCode = 10399
        cursor.execute("SELECT CustCode, CustTitle, CustName, CustAddr1 FROM EMCust WHERE CustCode = ?", vals['code'])
        rows = cursor.fetchall()
        print rows
        print '-----------------------'
        print rows[0][2]
3. result of query is bolow:
[('10399', '??????', '??? ?? ?? ???????????? ?????', '155/3  ??????????????   ??
????????')]
-----------------------
??? ?? ?? ???????????? ?????

What is the expected output? What do you see instead?
result I got is ????? but I want a result that show right language. 

What version of the product are you using? On what operating system?
I am using Python 2.7,SQL SERVER, and pyodbc module 3.0.5, windows xp and window server 2003


Please provide any additional information below.
I should show thai language not "????". I  query data form sql server and insert in to postgresql.
May 23, 2012
Project Member #1 mkleehammer
What is the actual data type of CustTitle, VARCHAR or WVARCHAR?

I'm assuming it is VARCHAR and the CHARSET is supposed to override the default interpretation.

Normally I would expect Unicode data to be defined with WVARCHAR and for it to be returned as UCS2 data.  In that case, pyodbc would return Unicode characters (assuming Thai "fits" into UCS2).

There seems to be a common need for UTF8 conversion with MySQL also.  If your data type is VARCHAR, would you be willing to test a beta version of pyodbc with a new UTF8 feature?
Status: Hold

Powered by Google Project Hosting