which is the right place to send a header in a yii-app?
header('content-type: text/html; charset=utf-8');
which is the right place to send a header in a yii-app?
header('content-type: text/html; charset=utf-8');
Usually it is authomatically generated in layout/main.
Take also a look at this article
It’s only added automatically if you configure your webserver (Apache) with AddDefaultCharset UTF-8. If you can’t do that for some reason, i’d either put it into index.php (for simplicitys sake), into the init() method in protected/Controller.php, or any action, where you need to set it, if it’s not required for all actions.
as long as there are no conflicts, i put it in index.php
default charset is iso-8859-1, its not possible to overwrite via htaccess
hello geeks…
I also been searching solution for utf8. and finally solved… here the solution…
[font="Arial Black"]open protected/config/main.php and save it as UTF8 without BOM (and BOM!!!!!) it is ready.[/font]
they said that yii’s default charset is utf8… so I figure out this from my previous experiences…
if there is still problem… then open all *.php files and save them in [font="Arial Black"]UTF8 without BOM[/font]
that will solve the problem…
You can put it on config/main.php too, since it’s included in index.php, and then if you have a problem you can figure it out.
Anyway, I thought that the ‘charset’=>‘utf-8’, would do the trick but no.