ankursal / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

query result ??????? #262

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by kathawu...@gmail.com on 16 May 2012 at 3:03

GoogleCodeExporter commented 9 years ago
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?

Original comment by mkleehammer on 23 May 2012 at 8:12