module ActiveSupport::JSON::Encoding

def escape(string)

def escape(string)
  string = string.encode(::Encoding::UTF_8, :undef => :replace).force_encoding(::Encoding::BINARY)
  json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }
  json = %("#{json}")
  json.force_encoding(::Encoding::UTF_8)
  json
end