Text Encoding

Hi there just want to throw following observation:

Started DB worked with it and all fine, but then all of the "sudden" :

PHP Error


htmlspecialchars() [<a href='function.htmlspecialchars'>function.htmlspecialchars</a>]: Invalid multibyte sequence in argument

In the end it turned out to be very easy , the point:

My Database (of course) is UTF-8 encoded, so no problem in the first, then after some time i put in Öl into one Table Value, which was the first time a multy byte value came into place.

In the end all easy and logical to be treated in the main.php :




		&#039;charset&#039;=&gt;&#039;UTF8&#039;,&nbsp; #&lt;===== That&#039;s all needed




i added the 'charset'=>'UTF8', there, and all is fine now

Had the same issue, and according to documentation, if not defined, Yii will use the reported character encoding used by the database.

That seems to be true and not true… It will use the encoding used by the databaseengine. The MySQL engine uses LATIN-1 by default.

So even if the DB you use is in utf8_general_ci, apparently MySQL reports its own internal schema back to PDO.

To change that, see: http://dev.mysql.com…figuration.html.

Just to let people know that I encountered the same issue, and solved the problem as trahe suggested.

Thank you trahe! :)