Skip to Content.
Sympa Menu

freetds - [freetds] How to get UTF-8 back in application

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: bohica AT ntlworld.com
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] How to get UTF-8 back in application
  • Date: Tue, 19 Jul 2005 10:26:11 +0100 (BST)

Hi,

Using FreeTDS 0.63.
Linux
iconv -l returns a list containing UTF-8.
my LANG, LC_ALL and LINGUAS are normally en_US

Goal: connect to SQL Server Enterprise Edition (8.00.760) from Linux to
application linked with unixODBC with results returned as UTF-8.

What I have tried:

1. unixODBC's isql with DSN in unixODBC's system odbc.ini
DSN:
[msfreetds]
driver = freetds
Description = freetds test
Server = myserver
Database = test
Port = 1433
TDS_Version = 7.0
client charset = UTF-8


"client charset = UTF-8" in DSN - does not seem to be read by freetds

"client charset = UTF-8" in freetds.conf never picked up because
freetds.conf file never opened (I straced it). Setting TDSDUMPCONFIG
didn't help either.

2. Tried [1] again but with LANG=UTF-8, LC_ALL=UTF-8
Still no luck. log file shows:

10:12:45.788239 Starting log file for FreeTDS 0.63
on 2005-07-19 10:12:45 with debug level 99.
10:12:45.788612 names for ISO-8859-1: ISO-8859-1
10:12:45.788661 names for UTF-8: UTF-8
10:12:45.788693 names for UCS-2LE: UCS-2LE
10:12:45.788723 names for UCS-2BE: UCS-2BE
10:12:45.788753 iconv to convert client-side data to the "ISO-8859-1"
character set
10:12:45.788857 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
10:12:45.788930 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"

3. Created entry in freetds.conf as:
[freetest]
host = aslaug
port = 1433
client charset = UTF-8
tds version = 7.0

and used tsql:

rm /tmp/freetds.log
/usr/local/freetds/bin/tsql -S freetest -U x -P y
locale is "en_US"
using default charset "ISO-8859-1"

freetds log:

10:18:19.400554 Starting log file for FreeTDS 0.63
on 2005-07-19 10:18:19 with debug level 99.
10:18:19.400730 names for ISO-8859-1: ISO-8859-1
10:18:19.400770 names for UTF-8: UTF-8
10:18:19.400795 names for UCS-2LE: UCS-2LE
10:18:19.400818 names for UCS-2BE: UCS-2BE
10:18:19.400865 iconv to convert client-side data to the "ISO-8859-1"
character set
10:18:19.400964 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
10:18:19.401027 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"

4. do [3] again with LC_ALL set:

rm /tmp/freetds.log
LC_ALL=UTF-8 /usr/local/freetds/bin/tsql -S freetest -U x -P y
locale is "C"
using default charset "ISO-8859-1"

freetds log same as in 3.

Can anyone tell me please, where I'm going wrong. All I'd like to do is write
a
small ODBC app which issues sql and retrieves result converted into UTF-8 by
freetds. My table contains some international characters like a euro - 0x20ac.
Perhaps this is not possible.

Thanks.




Archive powered by MHonArc 2.6.24.

Top of Page