首页 > 代码库 > Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier

php 连接 sqlserver 时, 程序生成的sql语句, 如果在 sqlserver客户端执行时, 可以正确返回结果, 在程序中执行, 总返回 false, 打开调试也没有任何错误。 无意中发现了如题所示的错误, 处理办法如下:

  • Chang the version in /etc/freetds.conf from 4.2 to 8.0 (if the PHP server is *nix)
  • client charset = GBK

php.ini 配置

mssql.charset = "UTF-8"

 

参考: http://www.php.net/manual/en/function.mssql-query.php 查询关键词为 Unicode data in a Unicode-only

       https://stackoverflow.com/questions/5414890/mssql-query-issue-in-php-and-querying-text-data/5414970#5414970

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier