Link to home
Create AccountLog in
Avatar of bruno_boccara
bruno_boccaraFlag for France

asked on

charset encode: accent problem with MSSQL2008 / PHP5.3.4 / Apache 2.2 and PDO_SQLSRV Driver 2.0

I just upgrade to PHP5.3.4/Apache2.2 and MSSQL 2008
I have problem of accent from data that I retrieve from the DB.
the charset encode of the site is iso-8859-1  (and accent from html code are displayed normally)
the charset encode of the DB is FENCH_CI_AS
I saw in many forum that we should define the charset of the DB when connecting to it from PHP but I didn't find the good syntax.....
thanks for your help
Avatar of Ovunc Tukenmez
Ovunc Tukenmez
Flag of Türkiye image

Avatar of bruno_boccara


With PDO_SQLSRV Driver, there is no mssql.charset .
mssql library do not work anymore with PHP 5.3.4
PDO_SQLSERV 2.0 is the new library that replace it.
I saw in php site that we could include the charset during the connection but when I try to do this, it doesn't work...(could not connect to server).
$db = new PDO('dblib:host=your_hostname;dbname=your_db;charset=UTF-8', $user, $pass);

is this because I try to make the DB in utf-8 and the DB charset is french_ci_as ?.

I'm searching for 2 days......getting crazy...

Avatar of bruno_boccara
Flag of France image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
i'm glad you've solved the problem.
thank you.
I found by myself the solution.....

thanks to jet-black for his help.