aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2009-02-15 04:09:50 +0900
committerJeremy Kemper <jeremy@bitsweat.net>2009-02-17 11:58:53 -0800
commit7c0e008973e594ebf53607362c1dfbe34b693600 (patch)
tree98ee6f2f540c071e452bc2abbbb76f8b35375a97 /activesupport/lib/active_support
parentb6e56efe07cb3c2e999216f995403aa9206226a2 (diff)
downloadrails-7c0e008973e594ebf53607362c1dfbe34b693600.tar.gz
rails-7c0e008973e594ebf53607362c1dfbe34b693600.tar.bz2
rails-7c0e008973e594ebf53607362c1dfbe34b693600.zip
Ruby 1.9 compat: fix JSON decoding to work properly with multibyte values
[#1969 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/json/decoding.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
index 9da4048272..5eb8c0fd7d 100644
--- a/activesupport/lib/active_support/json/decoding.rb
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -46,10 +46,11 @@ module ActiveSupport
json.gsub(/\\\//, '/')
else
left_pos = [-1].push(*marks)
- right_pos = marks << json.length
+ right_pos = marks << scanner.pos + scanner.rest_size
output = []
left_pos.each_with_index do |left, i|
- output << json[left.succ..right_pos[i]]
+ scanner.pos = left.succ
+ output << scanner.peek(right_pos[i] - scanner.pos + 1)
end
output = output * " "