[freetds] trouble with UTF-8 input data with mssql_bind
James K. Lowden
jklowden at freetds.org
Mon Dec 7 21:34:33 EST 2009
Tomasz Kurkiewicz wrote:
> I'm using FreeTDS 0.82 to execute a stored procedure on a MS SQL Server
> 2005. Unfortunately, I keep getting error messages while executing a
> stored procedure using mssql_bind.
> Web server is Fedora 8, PHP 5.3.0, freetds 0.82, database server is
> called MSSQL.
> Client encoding is UTF-8, parameters are all nvarchars, it fails on a
> first nvarchar parameter (look at freetds.log).
> freetds.log says:
> "Error converting characters into server's character set. Some
> character(s) could not be converted"
> "The incoming tabular data stream (TDS) remote procedure call (RPC)
> protocol stream is incorrect. Parameter 2 ("@user_agent"): Data type
> 0xA7 has an invalid data length or metadata length."
I would be interested in a TDSDUMP log that includes the parameter binding
functions and the error returned by the server.
It's likely you've hit a long-standing problem. There's not much encoding
conversion built into the parameter binding functions in db-lib. The
expectation is that the bound buffer holds data encoded in the same form
as the column to which it applies. That could be changed, but someone has
to want to....
More information about the FreeTDS