Strange string encoding behaviour with pymssql

Fabrizio Cornelli fabrizio.cornelli at gmail.com
Fri Sep 1 04:59:29 EDT 2006


Hello,
  I'm using pymssql to extract data from a legacy table with a non-ascii
encoded name.
The strange thing is that I can make my query from the idle's console, but
it doesn't work from python. (I'm working in a windows environment)

The error shows that there's a problem related to the encoding, I've tried
to excplicit it in a -*- coding: latin-1 -*- fashion, but it seems it's not
enough. Converting with unicode(query,encode) trying all the known encoding
formats dowsn't work as well.

I tried something like: mssql.query("select id_attività from prodotti") and
I have an error in the form:
pymssql.DatabaseError: internal error: SQL Server message 207, severity 16,
stat
e 3, line 1:
Il nome di colonna 'id_attivitÓ' non è valido.

As you can see 'id_attività' has been wrongly converted in 'id_attivitÓ' .

Why, I wonder, idle's console and pythonwin can manage correctly the string
and python.exe does not?

Is it a problem related to pymssql and this is not the right place where to
post it, or is there someone that could show me a solution?
Thanks in advance for any hint.

-- 
Fabrizio Zeno Cornelli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060901/a06b1094/attachment.html>


More information about the Python-list mailing list