Skip to Content.
Sympa Menu

freetds - Re: [freetds] Dealing with MSSQL Unicode data

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Dealing with MSSQL Unicode data
  • Date: Thu, 9 Mar 2006 14:57:21 +0100

>
> (Was using digest mode which isn't the best for responding to
> messages!)
>
> Ok, so I've chalked my errors below up to cruddy data in the database,
> and a flawed test (was looking at one database for one thing,
> another db
> for another). In general, we've found our issue.
>
> We were using odbtp to transport php/apache/freebsd database calls to
> mssql - everything was good in testing (we had no problems, and
> performance was pretty nice). It doesn't require you to use
> the "INSERT
> INTO ... (nvarcharcol) VALUES (N'unicode')" syntax (it seems to
> automagically munge the query on the way). When we tested
> with freeTDS,
> this is not the case (really, the way we should have expected), so our
> inserts without the N'' were coming in as ascii to mssql.
>
> This is a failing of our code (reliance on PEAR::DB and the
> autoprepare
> functions, which don't seem to know about this convention), and we're
> working around that.
>
> As a big thanks to the FreeTDS community, we've switched away
> from odbtp
> because of stability issues of their transport agent (odbtpsrv) and
> we're rolling out FreeTDS as our primary connector for a 20+ webserver
> infrastructure. We'll be looking into FreeTDS pooling servers in the
> future as we continue to require more front-end servers.
>
> We're also looking for any performance tuning tips you guys may have -
> but since my request here is at the end of a long email, I'll make
> another request later after perusing through the docs again.
>
> Thanks again.
>

The problem with characters mainly raise from different encoding.
Usually using a windows client you use a machine with same encoding of
server. For this reason client do not need to convert any characters but
just copy string as binary. Using a Unix client encoding is different
(many time just slightly but different) so we decided to convert to
server from client and back. This fixed a lot of problems but add some
complexity. Someone suggested to force unix encoding with same of server
(usually windows-1252 for english people). FreeTDS is able to detect
this situation and switch back to binary copy.
Sometimes I think that is would be useful to have a fast restricted
iconv embedded in FreeTDS (mainly to transcode easy and usual cases like
single-byte <-> single-byte) but this introduce another possible level
to I never started coding...
Which charset are you trying to use?

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page