Yii Framework Forum: Text Encoding - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Text Encoding Rate Topic: -----

#1 User is offline   trahe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 05-December 08

Posted 06 December 2008 - 08:16 PM

Hi there just want to throw following observation:
Started DB worked with it and all fine, but then all of the "sudden" :

PHP Error

Description

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 :

'db'=>array(
            'class'=>'CDbConnection',
            'connectionString'=>'mysql:host=localhost;dbname=essensrechner',
'charset'=>'UTF8',  #<===== That's all needed
            'username'=>'essen',
            'password'=>'srechner',
        ),

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

#2 User is offline   Maxximus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 146
  • Joined: 24-November 08
  • Location:Spain

Posted 12 December 2008 - 11:28 AM

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.
0

#3 User is offline   Samuel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 25-November 10

Posted 25 November 2010 - 02:33 AM

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

Thank you trahe! :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users