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 245: UTF-16 in results instead of UTF-8, Mac OS X 64-bit
6 people starred this issue and may be notified of changes. Back to list
Status:  Hold
Owner:  ----


 
Reported by denis.st...@unipag.com, Mar 10, 2012
What steps will reproduce the problem?
1. install pyodbc 3.0.3 on Python 2.7.2, Mac OS X 10.7.3 64-bit
2. build FreeTDS 0.91 with iODBC, make connection to MS SQL Server 2008
3. run a query against a table containing column "Text" type of nvarchar(200)

c = pyodbc.connect("DSN=myDsn;UID=myUser;PWD=myPwd;CHARSET=UTF8")
r = c.execute("select top 3 Text from mytable")
for row in r:
    print row

What is the expected output? What do you see instead?
- I got results in UTF-16, expected UTF-8. Problem looks very similar to https://code.google.com/p/pyodbc/issues/detail?id=78

What version of the product are you using? On what operating system?
- Mac OS X 10.7.3 64-bit
- Python 2.7.2
- pyodbc 3.0.3
- iODBC Driver Manager: 03.52.0607.1008 (this iODBC version is shipped by default together with Mac OS)
- FreeTDS 0.91
- MS SQL Server 2008

My config files:

odbc.ini:
---------------
[myDsn]
Description = myDb
Driver = TDS
Database = myDb
Servername = myServer
Uid = myUser
Pwd = myPwd


odbcinst.ini:
---------------
[global]
text size = 64512

[TDS]
Description = FreeTDS Driver
Driver = /usr/local/lib/libtdsodbc.so
UsageCount = 1


freetds.conf:
---------------
[myServer]
host = serverIP
port = 1433
tds version = 7.0
client charset = UTF-8


Please provide any additional information below.

I ran the same query against the same server, database and table using:
- Ubuntu 11.10 32-bit + Python 2.7.2 + pyodbc 3.0.3 + FreeTDS 0.91 + unixODBC 2.3.1
- Windows 7 64-bit + Python 2.7.2 + pyodbc 3.0.2  + built-in ODBC + SQL 11 Native Driver

both on Ubuntu and Windows results were returned in UTF-8. However when I ran the same script on Mac OS X 64-bit, I got results in UTF-16.

Sep 27, 2012
Project Member #1 mkleehammer
The freetdstests.py all pass, and they test varchar and nvarchar for all of the following sizes: 0, 1, 255, 256, 510, 511, 512, 1023, 1024, 2047, 2048, 4000.

I'm guessing there is something else.

Can you retest with pyodbc 3.0.6.  I am also using tds version 7.2, though I'm not sure if that would be necessary.

If you are still getting the error, can you supply a small test (a couple of values and how you are checking that they are in UCS-16).
Status: Hold
Labels: FreeTDS
Sep 29, 2012
Project Member #2 mkleehammer
(No comment was entered for this change.)
Labels: -FreeTDS Driver-freetds
May 7, 2014
#3 kesten.b...@gmail.com
I am seeing this on a 64bit mac with pyodbc 3.0.7 and unixodbc 2.3.2 connecting to vertica 6.1.2.  vsql and dbvisualizer both display rows in correct format.  pyodbc in ipython notebook or python shell show lines like u'\U00103030\udc8d\udc35...'

using hombrew installed python 2.7.6 and anaconda python 2.7.6

odbc.ini (relevant parts)
[ODBC Data Sources]
Vertica = vertica dev server

[Vertica]
Driver = Vertica
DriverManagerEncoding=UTF-8

vertica.ini
[Driver]
DriverManagerEncoding=UTF-8
ODBCInstLib=/usr/local/lib/libodbcinst.dylib
ErrorMessagesPath=/opt/vertica/lib


Powered by Google Project Hosting