in reply to UTF8 execute() parameters (DBI)

  1. Make sure that mysql is configured to use UTF-8 for everything
  2. Make sure the table is stored as UTF-8
  3. Use a recent DBD::mysql.
  4. Execute set names 'utf8'
  5. pass decoded strings to execute()
  6. ...
  7. profit

Replies are listed 'Best First'.
Re^2: UTF8 execute() parameters (DBI)
by MattLG (Beadle) on Apr 21, 2009 at 07:16 UTC

    Yup, all correct....'cept '7' :-(

      You've only shown us perl code in your question, nothing about your mysql setup, which is equally important.

      For example, if you open a terminal, first check that it works with UTF-8 (I assume Linux in my examples):

      $ echo Kärnten Kärnten $ echo Kärnten | hexdump -C 00000000 4b c3 a4 72 6e 74 65 6e 0a |K..rnten. +| 00000009

      If it looks any different, that's your first problem.

      Second step, try mysqldump $your_table | grep 'CHARSET=' - does that say UTF8 as well?

      Third step, try the insertion and then retrieval with mysql command line client - does that work?

      Fourth step, tell me the version of your DBD::mysql module.

        Yep, the database is entirely UTF8 (every table and text column), as is the terminal.

        Manual insertion and retrieval via the CLI works fine too.

        DBD::mysql = 4.005-26

        Cheers