class ApplicationController
def force_utf8_params
See https://rails.lighthouseapp.com/projects/8994/tickets/4807
See http://stackoverflow.com/questions/8268778/rails-2-3-9-encoding-of-query-parameters
That's what's happening in Rails 3, too: https://github.com/rails/rails/commit/25215d7285db10e2c04d903f251b791342e4dd6a
That's why we force the encoding of the params to UTF-8
That causes problems, especially when using special chars and with certain DBs, like DB2
When using TrustyCms with Ruby 1.9, the strings that come in from forms are ASCII-8BIT encoded.
def force_utf8_params traverse = lambda do |object, block| if object.is_a?(Hash) object.each_value { |o| traverse.call(o, block) } elsif object.is_a?(Array) object.each { |o| traverse.call(o, block) } else block.call(object) end object end force_encoding = lambda do |o| o.force_encoding(Encoding::UTF_8) if o.respond_to?(:force_encoding) end traverse.call(params, force_encoding) end