From f72a1ee7769c7a8507d130e7ea94610bd99a78c6 Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelaziz Date: Mon, 29 Dec 2014 12:02:13 +0200 Subject: [PATCH 1/2] fixed the Arabic encoding --- lib/active_support/json/encoding/active_support_encoder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_support/json/encoding/active_support_encoder.rb b/lib/active_support/json/encoding/active_support_encoder.rb index cdb0d44..ad88368 100644 --- a/lib/active_support/json/encoding/active_support_encoder.rb +++ b/lib/active_support/json/encoding/active_support_encoder.rb @@ -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 From db7264a6384a021dc116e5ee74adc96be2912b16 Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelaziz Date: Mon, 29 Dec 2014 12:11:30 +0200 Subject: [PATCH 2/2] update the readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1bef472..ec5bf80 100644 --- a/README.md +++ b/README.md @@ -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 ------------