database.yml: encoding: utf8 does not work

Joshua Muheim wrote:

Hi all

According to the Agile 2nd Ed book I added the line encoding: utf8 to my
database.yml connections.

But now when running rake I get plenty of errors:

Character set 'utf-8' is not a compiled character set and is not
specified in the '/usr/local/mysql/share/mysql/charsets/Index' file

What's wrong here?
I checked this Index file, but it seems to be empty...

Thanks a lot
Josh

You have to make sure your database is created to utf8 as the default
character set.

Quoting Edmond Chui <lists@ruby-forum.com>:

Joshua Muheim wrote:
> Hi all
>
> According to the Agile 2nd Ed book I added the line encoding: utf8 to my
> database.yml connections.
>
> But now when running rake I get plenty of errors:
>
> Character set 'utf-8' is not a compiled character set and is not
> specified in the '/usr/local/mysql/share/mysql/charsets/Index' file
>
> What's wrong here?
> I checked this Index file, but it seems to be empty...
>
> Thanks a lot
> Josh

You have to make sure your database is created to utf8 as the default
character set.

And that the encoding is called utf-8. In my config/database.yml I have:

  encoding: utf8

Also check the default and/or table(s) character set and collation in MySQL.

Jeffrey