Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-30-2008, 10:31 PM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default change default-character-set to UTF8

I already change the default-character-set to UTF8 in my.cnf file.
However, Zend_Db didn't return the data as UTF8.
How do I set the default-character-set to UTF8 in the ZF?

I don't want to call the following function on every connection:
$db->query('SET NAMES \'utf8\'');


Any advice is greatly appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-23-2008, 08:39 PM
Junior Member
 
Join Date: Jan 2008
Posts: 16
Default

Hi,

You could create a class that inherits from Zend_Db and there you can execute.
$db->query('SET NAMES utf8');
$db->query('SET CHARACTER SET utf8');

I my case the data are retrieved and saved correctly without supplying the character set.
I don't know if something is broken yet

The issue that I am having now is when I execute the following queries for Zend_Db_Adapter_Mysqli

if ($db instanceof Zend_Db_Adapter_Mysqli || $db instanceof Zend_Db_Adapter_Pdo_Mysql) {
$db->query('SET NAMES utf8');
$db->query('SET CHARACTER SET utf8');
}

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 50331646 bytes) in C:\www\websweet.ca\websweet\library\Zend-1.5.1\Zend\Db\Statement\Mysqli.php on line 227

Slavi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:35 PM.