Hi Martin,

Here's a patch against DBD::ODBC from subversion to fix utf8 handling
for Aster databases.

We connect to Aster (http://www.asterdata.com/, based on PostgreSQL)
via unixODBC.  We found that Aster always returns utf8 strings, but
when they got to perl, multibyte utf8 sequences were not translated
into unicode characters.  So, the character single character
"\x{263A}" from the database would be sent to perl as a two character
string like "\x{26}\x{3A}".

My solution was to added a "odbc_utf8_on" flag to the dbh and sth
handles.  If the odbc_utf8_on flag is set, DBD::ODBC will call
svUTF8_on() on all strings returned from the driver before returning
them to perl.

I looked at the unicode support in DBD::ODBC, but couldn't get it to
work with Aster since Aster does not return characters as SQL_C_WCHAR.

I made an exception so odbc_utf8_on would not affect SQL_C_BINARY columns,
but I haven't been able to test it.

Thanks for all your work on this module.  We use it a lot.  I hope my
contribution is useful.  Please let me know if you need anything else from
me, or if there's another way to solve this problem

Noel Burton-Krahn
[email protected]

Attachment: DBD-ODBC-1.23_2-utf8_on.diff.gz
Description: GNU Zip compressed data

Reply via email to