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