$params = array(
'host' => 'localhost',
'username' => 'YOURUSERNAME',
'password' => 'YOURPASSWORD',
'dbname' => 'YOURDATABASE',
'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;');
);
$db = Zend_Db::factory('PDO_MYSQL', $params);
But it's the same as using the Query at first, except, that UTF8 is set for lazy-loading. You could try setting the locale for your content, but normally you should be fine with UTF8 if converted correctly...
> -----Ursprüngliche Nachricht-----
> Von: Thasmo [mailto:thasmo@gmail.com]
> Gesendet: Sonntag, 26. April 2009 16:39
> An: denadai2
> Cc: fw-db@lists.zend.com
> Betreff: Re: [fw-db] Zend_Db insert and update utf-8 chars
>
> Maybe try to NOT use '$db->query("SET NAMES UTF8")'.
>
> denadai2 schrieb:
> > I've the same problem... Is there anyone that can help us?
> >
> >
> >
> > richardjansen wrote:
> >
> >> Hi there
> >>
> >> My database is MySQL, charset of the db is utf-8. I use PDO. I've
> done
> >> $db->query("SET NAMES UTF8"). Now I can read correctly from de
> database.
> >> The data in de db is how I want it (utf-8). The charset of de HTML
> is also
> >> utf-8.
> >>
> >> The problem: I'm trying to insert and update special chars (like é)
> with
> >> Zend_Db_Table_Abstract::insert (and update). The inserted data has
> stopted
> >> just before the special char. Foo é Bar -> Foo.
> >>
> >> Thanks for your comments,
> >> Richard Jansen
> >>
> >>
> >>
> >
> >
没有评论:
发表评论