utf8 for adodb to mssql issue
Posted: Fri Sep 12, 2008 2:40 am
I use adodb odbc for php to connect ms sql server
and the field type in mssql server is already setting as nvarchar or ntext
and web page has declare the character set as utf8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
but the data become garbage character in both mssql and mysql database
I got the solution for mysql, revise the driver like this
if ($this->_connectionID === false) return false;
+ @mysql_query("SET NAMES 'utf8'", $this->_connectionID);
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
how to do the same thing in mssql connection?
and the field type in mssql server is already setting as nvarchar or ntext
and web page has declare the character set as utf8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
but the data become garbage character in both mssql and mysql database
I got the solution for mysql, revise the driver like this
if ($this->_connectionID === false) return false;
+ @mysql_query("SET NAMES 'utf8'", $this->_connectionID);
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
how to do the same thing in mssql connection?