I recently ran into a nasty issue: when accessing a MSSql database from Linux with PHP and through FreeTDS I had some characters displayed wrong, like ° or similar. Everything was working fine, queries were ok, but for example in Adminer i saw weird characters in replacement of the good ones. After tweaking a bit with FreeTDS config I also had other errors, like
</p> <p>Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier</p> <p>
when displaying table structure.
I tried several config changes, like setting
in php.ini, but all were irrelevant.
client charset = UTF-8
in freetds.conf didn’t change anything.
Turned out being the tds version parameter of freetds.conf: I had set it to 11.0 which is the latest allowed by my FreeTDS version, but was misbehaving with those characters. Setting it to 8.0 solved the problem! So in the end this is the configuration I used in /etc/freetds/freetds.conf:
</p> <p>[servername]<br /> host = 192.168.1.5<br /> port = 49160<br /> tds version = 8.0<br /> server = INSTANCENAME\DBNAME<br /> client charset = UTF-8</p> <p>