Unicode and FreeTDS
Prev | Appendix C. About Unicode, UCS-2, and UTF-8 | Next

## Unicode and FreeTDS

Microsoft servers using TDS 7.0 and above (anything since Microsoft SQL Server 6.5) transmit their data in UCS-2 format (16-bit integers). Because most applications linked to FreeTDS are not prepared to deal with UCS-2 data, FreeTDS can convert the data to something more acceptable, including ASCII. To do so, it employs an iconv library. FreeTDS determines the server's encoding from the TDS protocol and information reported by the server (generally per connection, but in the case of TDS 7.1, per result set column). It discovers the client's encoding in `freetds.conf`. FreeTDS will happily convert and convey your data in any single-byte format that iconv can provide. In practice, this normally means some form of ISO 8859-x or UTF-8.

At some future time, FreeTDS aims to support Unicode and other multi-byte character sets. It does not do so at the current time, beside using wide functions in ODBC.

Sybase servers, by the way, adhere to a “server makes right” policy: they transmit their data in whatever character set the client requested at login time. The list of available character sets is fairly short, but includes UTF-8. While FreeTDS could convert Sybase data streams as easily as it does Microsoft data streams, to our knowledge no one is doing so. The Sybase server can perform the conversion itself, making FreeTDS's capability in this regard largely redundant and irrelevant.

### For further information

UTF-8 and Unicode FAQ for Unix/Linux, by Markus Kuhn. As the man says, very comprehensive.
ASCII: American Standard Code for Information Infiltration, by Tom Jennings. Everything you ever wanted know about ASCII, but didn't know whom to ask.
A Brief History of Character Codes, by Steven J. Searle. Includes useful references.
Unicode Home Page.

Prev | Up | Next
Unicode Transformation Format: UTF-8 | Home | Appendix D. GNU Free Documentation License