gevalia
(Af)
August 14, 2012, 2:18pm
1
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?
xtan
(Relations Team)
August 14, 2012, 2:39pm
2
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.
gevalia
(Af)
August 15, 2012, 9:50am
3
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 ?
Keith
(Kburton)
August 15, 2012, 11:47am
4
gevalia
(Af)
August 15, 2012, 2:34pm
5
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?