Swapping the FreeTDS odbc driver for the EasySoft driver on ubuntu 9.04 with RoR and sqlserver 2008 caused fields typed as varchar(max) to be interpreted as binary.
EasySoft support response:
The problem is that your application is taking the large size of the
field and assuming it is a BLOB type. FreeTDS is working because they
do not support VARCHAR(MAX) to its limit - they only return a subset
of the data. In your ODBC data source try adding / amending :-
VarMaxAsLong = Yes
If that does not work try :-
DisguiseLong = Yes
LimitLong = size - Where size is a byte value of the maximum size of
the field.
Setting all three attributes as suggested in /etc/odbc.ini file made
the problem did go away. The varchar(max) data displays correctly as
text.