Sha256: ac9fbf0dac1889e9b369ab6eb10599f9eb7b8c23eb1d6e7f0d61251383e489e0
Contents?: true
Size: 436 Bytes
Versions: 2
Compression:
Stored size: 436 Bytes
Contents
module ActiveSupport::JSON::Encoding class << self def escape(string) if string.respond_to?(:force_encoding) string = string.encode(::Encoding::UTF_8, :undef => :replace).force_encoding(::Encoding::BINARY) end json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] } json = %("#{json}") json.force_encoding(::Encoding::UTF_8) if json.respond_to?(:force_encoding) json end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guara-0.0.3 | config/initializers/json_paches_utf8.rb |
guara-0.0.1.rc | config/initializers/json_paches_utf8.rb |