[DB-SIG] International content

M.-A. Lemburg mal@lemburg.com
Thu, 26 Jul 2001 10:23:47 +0200


Ryan Weisenberger wrote:
> 
> I'm still having problems with international character sets in
> databases.  I'm using MS SQL Server 2000, and connecting to it with mxODBC
> through the 2000 SQL Server ODBC driver.  If I have a table with
> international characters in the table name, here's what happens.  I issue:
> 
>  >>> import mxODBC
>  >>> db = mxODBC.Connect('japanese','sa','')
>  >>> c = db.cursor()
>  >>> c.tables(None,None,None,'TABLE')
> -1
>  >>> c.fetchall()
> [('japanese', 'dbo', '?????', 'TABLE', None)]
>  >>>
> 
> No table name, just question marks. 

The question marks indicate that the ODBC driver does not know
how to convert the Unicode data into the encoding your are
using for the connection to the database. I am unsure where
the conversion actually happens (in the database, the ODBC driver
or the manager), but I was told that you can specify the encoding
to be used for the translation using some database parameter.

> How can I get around this?  Where are
> the characters getting obliterated?  Is it in the ODBC driver, or before
> they ever leave the database?

BTW, you should use 

from mx.ODBC import Windows
dbc = Windows.Connect(...)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/