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

MBMSOFT

Registered User.
Local time
Today, 05:00
Joined
Jan 29, 2010
Messages
87
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

error reading drive A:
Local time
Today, 12:00
Joined
May 7, 2009
Messages
9,323
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, 07:00
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 (Users: 0, Guests: 1)

Top Bottom