Subject: | DBD::ODBC doesn't handle windows-1252 characters correctly |
Using DBI 1.616 and DBD::ODBC 1.29 in ActivePerl 5.12.2 Build 1202 on
Windows 7 to connect to an SQL Server database with default collation
SQL_Latin1_General_CP1_CI_AS, I get data in varchar columns (normal, not
wide) back in un-decoded windows-1252.
(For instance a Euro sign, "€", is 0x80 instead of 0x20AC.)
Workarounds are:
- decode myself, using Encode::decode('windows-1252', $val) for each
column after each fetch
- explicitly set column type to SQL_WCHAR
This shouldn't be necessary, though.
If it isn't possible for DBD::ODBC to detect that data is encoded in
windows-1252, perhaps a database handle attribute could be added to tell
DBD::ODBC the encoding of the ODBC connection?
See also:
http://stackoverflow.com/questions/5912082/automatic-character-encoding-handling-in-perl-dbi-dbdodbc