From 8f8397e0a4ea2bbc27d4bba60088286217314807 Mon Sep 17 00:00:00 2001 From: Brett Carter Date: Thu, 13 Dec 2012 15:52:19 -0800 Subject: Remove unicode character encoding from ActiveSupport::JSON.encode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters not in the Basic Multilingual Plane. It is possible to escape them for json using the weird encoding scheme of a twelve-character sequence representing the UTF-16 surrogate pair (e.g. '𠜎' -> "\u270e\u263a") but this wasn't properly handled in the escaping code. Since raw UTF-8 is allowed in json, it was decided to simply pass through the raw bytes rather than attempt to escape them. --- activesupport/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport/CHANGELOG.md') diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 82db1bb6f9..5e7121181d 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,4 +1,10 @@ ## Rails 4.0.0 (unreleased) ## +* Remove surrogate unicode character encoding from ActiveSupport::JSON.encode + The encoding scheme was broken for unicode characters outside the basic multilingual plane; + since json is assumed to be UTF-8, and we already force the encoding to UTF-8 simply pass through + the un-encoded characters. + + *Brett Carter* * Deprecate `Time.time_with_date_fallback`, `Time.utc_time` and `Time.local_time`. These methods were added to handle the limited range of Ruby's native Time -- cgit v1.2.3