SQL Server with FreeTDS Unicode Data Error

Update (Aug. 28, 2011): You may want to check out tiny_tds which obviates many of the below settings and gives you a richer and more scalable connection than ODBC. If you get

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.

when connecting to SQL Server from Linux via FreeTDS, you don'tset the FreeTDS version correctly. To use SQL Server from Rails, I usually just create shared DSNs in /etc/odbc.ini (Ubuntu) with connection information that looks like so:

Note the syntax: It must be Server, NOT Servername Update: this only applies to the odbc.ini setup used here, if you need to read client charset = UTF-8 from freetds.conf, it has to be Servername, see update below and TDS_Version has an underscore. The standard ODBCConfig visual tool will usually set ?Servername? instead of ?Server? and this will not work. The above settings should just work (provided FreeTDS is installed correctly) with the ActiveRecord SQL Server adapter and these settings in database.yml: