Hi Anders,

you can use the following to create the adapter if you're using the
PDO-adapters:

$db=Zend_Db::factory('Pdo_Mysql', array(
        'host'           => 'localhost',
      'username'       => 'user',
      'password'       => 'pa$$w0rd',
      'dbname'         => 'database',
      'driver_options' => array(
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
        )
));

This ensures that the SET-NAMES-Command is issued with every reconnect of
the underlying adapter.

Best regards

Stefan

-----Ursprüngliche Nachricht-----
Von: Anders Gunnarsson [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 27. Juni 2008 09:10
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] Re: sql lower encoding

The encoding problems ended when setting
$this->query('SET NAMES utf8');
at both insert and select.

Is there a better way to do this? At db-connection time?




Johannes Schill wrote:
>
> If you're inserting with a form, you can always try adding 
> accept-charset="UTF-8" on your form-tag.
>
> Johannes 
>
>
> 2008/6/26, Anders Gunnarsson <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>:
>
>     I found out that my problem must be on inserting.
>
>     How can I be sure that I'm inserting with utf8?
>
>     If I insert ÅÄÖ in phpmyadmin, they are inserted correctly,
>     but not when inserting from my own forms.
>
>     I've tried
>     $this->query('SET NAMES utf8');
>     before inserting, but it doesn't seem to help.
>
>     can I use config.ini to specify utf8?
>     and would that help?
>
>     regards
>     Anders
>
>
>     Anders Gunnarsson wrote:
>
>         Hi!
>
>         I'm doing a SQL LIKE() with non-western characters.
>
>         SELECT * FROM users WHERE LOWER(userName) LIKE '%'.
>         mb_strtolower($searchStr, mb_detect_encoding($searchStr)) .'%'
>
>         The php is converting the characters right,
>         but the SQL isn't.
>
>         I'm using mysql 5.0.38
>         and utf8_unicode_ci
>
>         Maybe somebody has an other sollution to searching
>         case-insensitive with non-western characters?
>
>
>

Reply via email to