[freetds] Character conversion (how to stop it)
James K. Lowden
jklowden at freetds.org
Sat Dec 5 17:01:50 EST 2009
Plot Lost wrote:
> Is there any way to get freetds to simply leave the data alone and not
> do any iconv conversion or anything else.
> i.e. the char type data is left untouched in whatever codebase the
> server is using, and nchar type data is left untouched as ucs2.
> Porting some code written using sybase ctlib to use freetds and sql
> server, all of the code manipluates all of the data as ucs2, and it's
> going to add considerable overhead (and wasted effort) to keep
> converting ucs2 from the database into utf8 in freedts back into ucs2
> for the code to deal with and back again the other way.
> All of the iconv stuff seems fairly well embedded into it, and I could
> not see a simple way of striping it out or disabling it. Anyone have any
> pointers as to how this can be done.
The design intention: if the client and server have the same encoding,
iconv doesn't engage. If you find a case where that's not true, it would
be considered a bug.
For your purpose, that means setting the client to UCS-2LE. The
difficulty will likely be that you'll be on a weedy path, because no one's
really done very much with UCS-2 clients. Frediano has an interest in it
for ODBC. db-lib has some built-in restrictions that would require
deviation from specified behavior in order to make UCS-2 work (and I have
no particular use for that kind of extension).
That leaves ct-lib, about which I don't know much. From your description,
it sounds like ct-lib's design handles UCS-2 fine. From there, it's just
a matter of implementation....
More information about the FreeTDS