Created
May 27, 2012 12:27
-
-
Save mikz/2813751 to your computer and use it in GitHub Desktop.
Make Rails 2.3.x play nice with Ruby 1.9.x. Forces encoding to UTF8 for every string in parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module UTF8 | |
module Params | |
private | |
def normalize_parameters_with_encoding(value) | |
normalize_parameters_without_encoding(value).tap do |value| | |
value.force_encoding(Encoding.default_external) if value.respond_to?(:force_encoding) | |
end | |
end | |
end | |
end | |
ActionController::Request.class_eval do | |
include UTF8::Params | |
alias_method_chain :normalize_parameters, :encoding | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yay Ruby!!