utf-8 support


I am trying to use utf-8 Tamil in a Rails application. When I edited Tamil unicode contents in a text
box and checked the output. The text got distorted when it is showing it back.

Any help appreciated

Are you using any plug-ins? I have an application that uses Mandarin
Chinese. It works beautifully with the standard installation of Rails
but when I added the Ferret text search plug-in, I could no longer use


There are several things you need to do.
1) Make sure your database has UTF-8 internationalization set
2) Check this out: http://wiki.rubyonrails.org/rails/pages/ InternationalizationComparison.
3) Use this for rails 1.1

script/plugin install http://svn.globalize-rails.org/svn/globalize/ globalize/ branches/for-1.1.

I’ve had that problem as well.

Adding this as a before_filter to application.rb seems to fix things. It makes sure that all rhtml files are set to utf8, and spares RJS from setting the content-type header so the code still executes.

# Switches to UTF8 charset

I apologize for pointing people to my blog and then having it tank. I'm having some server issues.

Allow me to say that my solution is not as elegant as RaPT but in case you're interested, here is my install_plugins.rake (in the lib/tasks directory)

require 'yaml'
namespace :plugins do
desc "install a known list of plugins, specified in config/base_plugins.yml"
     task 'install_base' do
         f = YAML::load_file(File.join(RAILS_ROOT, 'config', 'base_plugins.yml'))
         f.each_pair do |plugin, options|
             force, svn = '', ''
             force = ' --force' if (options[:force] && options[:force].downcase == 'yes')
             svn = ' -X' if (options[:svn] && options[:svn].downcase == 'yes')
             if force.empty? && File.exist?(File.join(RAILS_ROOT, "vendor/plugins/#{plugin}"))
                 puts "Skipping #{plugin} -- already installed and force options not specified."
                 cmd = "ruby #{RAILS_ROOT}/script/plugin install #{svn}#{options['repos']} #{plugin}#{force}"
                 puts "*** installing #{cmd}"

Here is my standard 'base_plugins.yml' (in the config directory)

   repos: http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/
   repos: http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
   repos: svn://rubyforge.org/var/svn/rspec/tags/REL_0_7_4/vendor/rspec_on_rails/vendor/plugins/rspec