Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ A pure-Ruby ActiveSupport JSON encoder. This was the default encoder used
by ActiveSupport prior to Rails 4.1. The main advantage of using this
encoder over the new default is for the `#encode_json` support (see below).

Update: Fixed the UTF-8 encoding problem.

Installation
------------

Expand Down
2 changes: 1 addition & 1 deletion lib/active_support/json/encoding/active_support_encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def encode_json(encoder) #:nodoc:

class String
def encode_json(encoder) #:nodoc:
ActiveSupport::JSON::Encoding::ActiveSupportEncoder.escape(self)
ActiveSupport::JSON::Encoding::ActiveSupportEncoder.escape(self.dup.force_encoding("UTF-8"))
end
end

Expand Down