Rails3.x でASCII 8bitで渡ってきたparamsハッシュパラメータのキーと値をUTF-8化するメソッド
def encodeToUtf8(params)hash = {}
params.map do |key, val|
dupKey = key.dup unless key.instance_of? NilClass
dupVal = val.dup unless val.instance_of? NilClassdupKey.force_encoding('UTF-8') if key.instance_of? String
dupVal.force_encoding('UTF-8') if val.instance_of? Stringhash[dupKey] = dupVal
end
hash
end