Project

General

Profile

Feature #4050 » application_controller_chili_21a45b4e.diff

Toshi MARUYAMA, 2011-10-30 12:46

View differences:

app/controllers/application_controller.rb
43 43
    end
44 44
  end
45 45

  
46
  # FIXME: Remove this when all of Rack and Rails have learned how to
47
  # properly use encodings
48
  before_filter :params_filter
49
  def params_filter
50
    self.utf8nize!(params) if RUBY_VERSION >= '1.9'
51
  end
52
  def utf8nize!(obj)
53
    if obj.is_a? String
54
      obj.respond_to?(:force_encoding) ? obj.force_encoding("UTF-8") : obj
55
    elsif obj.is_a? Hash
56
      obj.each {|k, v| obj[k] = self.utf8nize!(v)}
57
    elsif obj.is_a? Array
58
      obj.each {|v| self.utf8nize!(v)}
59
    else
60
      obj
61
    end
62
  end
63

  
46 64
  before_filter :user_setup, :check_if_login_required, :set_localization
47 65
  filter_parameter_logging :password
48 66

  
(14-14/14)