I can\'t seem to get data from MSSQL encoded as UTF-8 using FreeTDS extension.
Connecting:
ini_set(\'mssql.charset\', \'UTF-8\');
$this->_resource
It seem version 7.0 or great is required. iconv() also seems to work well, but is tedious.
$query = $this->db->query($sql);
$result = $query->fetchAll(PDO::FETCH_OBJ);
foreach ($result as $row) {
foreach (get_object_vars($row) as $key => $value) {
$row->$key = (mb_detect_encoding($value, mb_detect_order(), true) === 'UTF-8')
? $value : iconv('iso-8859-1', 'utf-8', $value);
}
$results[] = $row;
}