[DB-SIG] unicode woes.
mal at egenix.com
Mon Sep 5 10:42:04 CEST 2005
jeff sacksteder wrote:
> Access 2000 and it's newer ilk use unicode for memo fields. Python's DBI
> chokes when reading data out of such fields, producing an error like this-
> 'Invalid character value for cast specification on column number 7'.
> I can state with certainty that there should be no non-ascii characters in
> those fields. Is there a way to alter the unicode 'cast'-ing step to drop
> unparsable characters?
> Whereabouts is that handled in DBI?
I'm not sure which DB interface you are talking about, but
I can assure you that mxODBC doesn't have those problems:
it will happily read and write Unicode to Access.
For backwards compatiblity reasons, mxODBC runs in 8-bit only
mode if not told otherwise. To have mxODBC connections run
in native Unicode mode you have to set them up using the
connection = mx.ODBC.Windows.DriverConnect(...)
connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT
connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT
For more information, have a look at the data types section
and the connection.stringformat documentation:
Hope that helps,
Professional Python Services directly from the Source (#1, Sep 05 2005)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the DB-SIG