Very strange: Umlauts (äöü) aren't displayed correctly in


There's a lot you need to do to make Rails handle UTF8 correctly. See

In short:

1. You need to make sure your database is set to use UTF8, which it
probably won't be if you've created it in CocoaMySQL. Use ALTER

2. You need to tell Rails to speak to the database in UTF8 by adding
"encoding: utf8" to each database in database.yml

3. You need to tell Ruby that you want to use UTF8 by putting the
following in your environment.rb:
   require 'jcode'

4. You need to make Rails pass back the correct content type header
by putting the following in application.rb:
   after_filter :set_charset

   def set_charset
     content_type = @headers["Content-Type"] || 'text/html'
     if /^text\//.match(content_type)
       @headers["Content-Type"] = "#{content_type}; charset=utf-8"


Pete Yandell

Joshua Muheim wrote:

But why isn't there just a switch in Rails that allows me poor german
(swiss german) user to use my beloved umlauts?

The simple answer is that nobody has built it yet! There are now a
couple of plugins floating around that provide much better unicode
handling, and there's discussion going on about including some of this
in Rails 1.2. You can expect the situation to improve with time.


Pete Yandell