database.yml: encoding: utf8 does not work

Hi, you should be able to add the encoding as follows to the database.yml file:

encoding: UTF8

Let me know if this works for you.

-Conrad

Hi, it's allways helpful to supply any relevant files when asking a
question about an error that one is receiving.

-Conrad

there are several places that can cause problems with utf-8 encoding.
but some tricks are to:

1. make sure that every file in your project is utf-8 based (if you
are using rad rails, this is simple to accomplish: mark your project,
select properties, in the "text-file-encoding" box, select "other:
utf-8")

Be sure to put in your strange "å,ä,ö" characters in your files again
or you'll get a mysql error, because it will change your "å,ä,ö" to a
"square" (unknown character)

2. in your databases.yml set for each server environment (in this
example "development" with mysql)

development:
  adapter: mysql
  encoding: utf8

3. set a before filter in your application controller
(application.rb):

class ApplicationController < ActionController::Base
  before_filter :set_charset
  def set_charset
    @headers["Content-Type"] = "text/html; charset=utf-8"
  end
end

4. be sure to set the encoding to utf-8 in your mysql (I've only used
mysql.. so I don't know about other databases) for every table. If you
use mySQL Administrator you can do like this: edit table, press the
"table option" tab, change charset to "utf8" and collation to
"utf8_general_ci"

uhmm.. that's all I can think of right now.