Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

execute unicode str without parameters #8

Closed
mdobrzanski opened this Issue · 1 comment

2 participants

@mdobrzanski

When using unicode query string, query doesn't execute.

import pyodbc
con = pyodbc.connect('DSN=Northwind; UID=vte; PWD=vte')
res = con.cursor().execute(u"select * from Customers where CustomerID = 'ĄŁÓ$!'").fetchall()
print len(res)
#output: 0, should be 1

When encoding query string utf-8 the result is the same - 0

My configuration on Ubuntu 10.04

FreeTDS 0.91 freetds.conf

[global]
        # TDS protocol version
        tds version = 8.0
        client charset = UTF-8
        text size = 64512

[mssql]
        host = hostname.somedomain
        port = 1433
        tds version = 8.0

unixODBC 2.3.0 odbcinst.ini

[FreeTDS]
Driver          = /usr/local/lib/libtdsodbc.so

[SQLServer]
Driver          = /usr/local/lib/libtdsodbc.so

obdc.ini

[Northwind]
Description = MS SQL Database
Driver      = FreeTDS
Servername  = mssql
Database    = Northwind
UID     = 
PWD     = 
Port        = 1433

pyodbc-3.0.2_beta01-py2.6

Select works fine when using
isql

isql Northwind vte vte
select * from Customers where CustomerID = 'ĄŁÓ$!'

or tsql

tsql -S mssql -U vte -P vte
use Northwind
go
select * from Customers where CustomerID = 'ĄŁÓ$!'
go

@mkleehammer mkleehammer was assigned
@mkleehammer
Owner

I realize this is a year old, but I had not been watching for Github issues, only the Google Code issues. Sorry about that.

Assuming anyone is still interested, my first guess is that UCS2 would be a better choice for SQL Server. I don't think it is expecting UTF8.

I'm going to close this just because it is so old, but please reopen if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.