djhenderson / pyodbc

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

How to get unicode data from nvarchar column? #152

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I can't select unicode data from nvarchar column. pyodbc always returns ascii 
data.

My code is:
import pyodbc
conn = 
pyodbc.connect(r'DRIVER={FreeTDS};SERVER=10.0.0.61\mssql2008;DATABASE=eoffice_cl
one;UID=erp;PWD=123;')
crms = conn.cursor()
crms.execute('SELECT cc_Name FROM tblHR_CodeClass')
for line in crms:
    print 'cc_Name:', line.cc_Name
    break
conn.close()

What is the expected output? What do you see instead?

expected output: 'cc_Name: Аймаг, хот'
but instead: 'cc_Name: ?????, ???'

What version of the product are you using? On what operating system?

I have pyodbc-2.1.8, TDS version 4.2, python-2.6, ubuntu-10.4

Please provide any additional information below.
I am trying to work with MSSQL2008 database on ubuntu using python.
Almost all text fields are NVARCHAR in my database.
At first, I just want to get unicode data as it stored in database.

Original issue reported on code.google.com by orgi...@gmail.com on 31 Jan 2011 at 6:11

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 28 Feb 2011 at 1:04