Problem with special chars from database

Hello,

I have a problem with yii displaying question-marks instead of special characters. It’s only the charecters from the database that’s affected by this problem.

I have tried changing the unicode to utf-8 everywhere but it still doesn’t work.

This is the code:

config/main.php




header('Content-Type: text/html; charset=utf-8');

...

'charset' => 'ISO-8859-1',

...

'db' => array(           

            'connectionString' => 'dblib:host=123;port=$portAddress;dbname=test',

            'username' => '***',

	    'password' => '***',

            'charset' => 'utf8'

        ),



in the header:




<meta charset="utf-8">



I use MSSQL 2000

Any ideas?

Try replacing




<meta charset="utf-8">

//with

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

If you got that set, there is no need to modify headers .

And double check, what the encoding of the db field, that returns question marks, is.

Tried to change that but still the same result.

Im not shure but it seems like MSSQL 2000 saves it’s unicode data in UCS-2 instead of UTF-8, is there a way to convert it to UTF-8 somehow ?

http://php.net/manual/en/function.mb-convert-encoding.php

Didn’t work either, it’s not a questionmark tho, now it’s more like chinese.

I noticed that when in main, when I change ‘charset’ => ‘ISO-8859-1’ to UTF-8 I get an error saying:

htmlspecialchars(): Invalid multibyte sequence in argument

Maybe it’s this error thats causing the problem?