I need to retrieve Cyrillic data from MSSQL database with PHP but I get back "??????? (1 Viewer)

MBMSOFT

Registered User.
Local time
Today, 20:50
Joined
Jan 29, 2010
Messages
90
I need to retrieve Cyrillic data from MSSQL database with PHP but I get back "???????

I need to retrieve Cyrillic data from MSSQL database with PHP but I get back "???????"

Code:
<?php

   $dbconn = new PDO('odbc:Driver=FreeTDS; Server=xxx.xxx.xxx.xx; Port=1433; Database=xxxxxx; UID=xxxx; PWD=xxxxx; )');

   if ($dbconn->connect_error) {die("Connection failed: " .    $dbconn->connect_error);}

    //$dbconn->debug = true;
    
$sql="select data1 from myTABLE where data2 ='text' ";

    $query = $dbconn->query($sql);
    $query->execute();
    $rs = $query->fetchColumn();

echo $rs;
?>

Result is "?????" instead of cyrillic text
Any idea how to get non-unicode characters from mssql database
Thanks...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:50
Joined
May 7, 2009
Messages
19,169
Re: I need to retrieve Cyrillic data from MSSQL database with PHP but I get back "???

Uh, check the post date.
 

abubasil

Registered User.
Local time
Today, 22:50
Joined
Aug 31, 2011
Messages
29
Re: I need to retrieve Cyrillic data from MSSQL database with PHP but I get back "???

A new reply for an old question for anyone drop in here.

The solution is to set the database, tables , and fields collation to utf8_unicode_ci.
as for the php files make them encode utf8 in BOM .
 

Users who are viewing this thread

Top Bottom