Some view helpers (at least link_to and render) crash due to
encoding errors although template is correctly saved in UTF8.
prerequisites:
rvm 1.9.1
gem install rails --pre
reproduce:
rails fails
cd fails
bundle install
rails generate scaffold failure name:string
rake db:migrate
echo "Failure.create! :name=>'äöä';puts Failure.first.name.encoding" | rails c
rails s
now point your browser to localhost:3000/failures and notice
that the view renders nicely, including
after hitting CTRL+C, paste this into the console:
echo "<%=link_to 'ÄÖÜßäöü', failures_path%>">>app/views/failures/index.html.erb
rails s
when you reload the failures page, you should see an Exception
"incompatible character encodings: ASCII-8BIT and UTF-8".
I don't see any workaround for this, as using HTML entities like
Ä will not work with link_to.
This may be also be an issue with the default sqlite3-ruby gem, as
the encoding seems to be ASCII-8BIT for the new value.
$ rails -v
Rails 3.0.0.beta
$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]
$ locale
LANG="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_CTYPE="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_ALL=