Warning: curl_exec() has been disabled for security reasons in /pub/host/sunboyu/sunboyu/www/wp-includes/http.php on line 1022
freetds 一个程序猿 孙小一,孙小二,PHP,MYSQL,LINUX,APACHE,原创技术,扯淡

在windows在安装FreeTDS,让mssql支持UTF-8

作者 : admin 于 2008年07月22日, 15:27:47
2008
07-22

本人有个项目使用php+mssql,而mssql只支持gb2312和utf-16编码,而php又要求使用utf-8编码,想到了freetds.而freetds是个在unix下开发的工具,我下载freetds最新版后,发现里边有windows下的编译脚本,在DEV-C++里进行编译后,不支持,后又从鬼子论坛里找到达人编译好的组件,安装配置后,正常,大喜。

; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
mssql.charset = “UTF-8″

在php.ini里设置这里,即可让FreeTDS生效。This is only used when compiled with FreeTDS。mssql默认是不支持设置字符集的,只有安装freetds的时候才能生效。

其实,PHP官方早就在系统里留出了freetds的接口,windows下的PHP.INI文件就为freetds留出接口参数。

在linux下,编译php的时候,有这样的日志

configure:68696: checking whether to enable pcntl support
configure:69264: checking whether to enable PDO support
configure:69689: checking for PDO_DBLIB support via FreeTDS
configure:70399: checking for Firebird support for PDO

在linux下,同样为php留出了接口