unicode server data incorrectly converted to iso-8859-1 on client

Razvan Cosma <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
 Hello,
I'm stuck with what seems to be a very old problem: getting non-latin texts
from SQL server 2005 into freetds. Using Perl's DBD::Sybase on Linux, all
freshly built latest versions, I have tried all sorts of incantations:

DBI->connect("dbi:Sybase:host=$dbserver;port=$dbport;database=[the-db];charset=utf-8;tds
version=9.0")

export LANG=en_US.UTF-8 (which does work, with various terminal apps)

checked if iconv works, it does and supports UTF

checked if freetds is built with iconv support
Version: freetds v0.82
freetds.conf directory: /etc
MS db-lib source compatibility: yes
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes

With an nvarchar(100) text field, I get the following in freetds.log:
write.c:136:tds_put_string converting 61 bytes of "select top 2 firstname
from users"
token.c:3294:adjust_character_column_size:
        Server charset: UCS-2LE
        Server column_size: 200
        Client charset: ISO-8859-1
        Client column_size: 100
token.c:1490:tds7_get_data_info:
        colname = firstname (9 bytes)
        type = 39 (varchar)
        server's type = 231 (x UCS-2 varchar)
        column_varint_size = 2
        column_size = 100 (200 on server)

and the dreaded error
Open Client Message:
Message number: SEVERITY = (9) NUMBER = (99)
Message String: Some character(s) could not be converted into client's
character set.  Unconverted bytes were changed to question marks ('?')

Any hints on how to explain to freetds that I want utf on the client end? Or
even unmodified ubcs2, at least I would be able to convert afterwards using
Perl..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.