elfranne has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am having some problems when getting some data from a MS-SQL server using DBD::Sybase: the encoding fails.
I am geting those errors :
DBD::Sybase::st fetchrow_hashref failed: OpenClient message: LAYER = ( +0) ORIGIN = (0) 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 ('? +') OpenClient message: LAYER = (0) ORIGIN = (0) 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 ('? +')
The characters are most likely to be country (Denmark) specific characters (æ ø å) but they are included in UTF-8. i am calling the db like this : my $dbh = DBI->connect("DBI:Sybase:server=$SERVER", $LOGIN, $PASSWD); freetds.conf :
(the server is not actually at localhost but a tunnel)host = localhost port 1433 tds version = 8.0 charset = UTF-8
I tried :
but it does not help.my $dbh = DBI->connect("DBI:Sybase:server=$SERVER;charset=CP1252", $LO +GIN, $PASSWD);
i added a variable to get some more logs from Freetds: export TDSDUMP=/tmp/freetds.log
I searched extensivly on google about this, and there is actually quite a lot of problems with M$ using CP1252 encoding...llog.c:190:Starting log file for FreeTDS 0.82 on 2011-09-27 16:54:38 with debug flags 0x4fff. iconv.c:363:iconv to convert client-side data to the "ANSI_X3.4-1968" +character set iconv.c:516:tds_iconv_info_init: converting "US-ASCII"->"UCS-2LE" iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" net.c:210:Connecting to 127.0.0.1 port 1433 (TDS version 8.0) net.c:264:tds_open_socket: connect(2) returned "Operation now in progr +ess" net.c:303:tds_open_socket() succeeded util.c:162:Changed query state from DEAD to IDLE login.c:735:quietly sending TDS 7+ login packet token.c:312:tds_process_login_tokens() net.c:592:Received header [...] iconv.c:985:setting server single-byte charset to "CP1252" iconv.c:516:tds_iconv_info_init: converting "US-ASCII"->"CP1252" token.c:2292:tds->collation now
I think the problem is that the MS-SQL server output is encoded in CP1252 and the Freetds decodes it as it were ISO-8859-1.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBD::Sybase and UTF-8
by mpeppler (Vicar) on Sep 28, 2011 at 07:13 UTC | |
by Anonymous Monk on May 26, 2016 at 15:11 UTC | |
by Anonymous Monk on Nov 22, 2017 at 03:46 UTC |
Back to
Seekers of Perl Wisdom