aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2006-10-12 21:00:34 +0000
committerMichael Koziarski <michael@koziarski.com>2006-10-12 21:00:34 +0000
commitcb927c8774f98c979b4e0466798d74bdd23a79f2 (patch)
treebda829dea1d17a3f84516fb26593b7435bc60548 /activesupport/lib/active_support/multibyte
parent787049467341a75de469b58bcfe84f0959a2c3af (diff)
downloadrails-cb927c8774f98c979b4e0466798d74bdd23a79f2.tar.gz
rails-cb927c8774f98c979b4e0466798d74bdd23a79f2.tar.bz2
rails-cb927c8774f98c979b4e0466798d74bdd23a79f2.zip
Make String#chars slicing behaviour consistent with String. Closes #6387 [Manfred Stienstra]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5286 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/multibyte')
-rw-r--r--activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb b/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
index c6ef6ad095..6c8eb88702 100644
--- a/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
+++ b/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
@@ -162,10 +162,10 @@ module ActiveSupport::Multibyte::Handlers
elsif args[0].kind_of? Range
cps = u_unpack(str).slice(*args)
cps.nil? ? nil : cps.pack('U*')
- elsif args[0].kind_of? Numeric
+ elsif args.size == 1 && args[0].kind_of?(Numeric)
u_unpack(str)[args[0]]
else
- str.slice(*args)
+ u_unpack(str).slice(*args).pack('U*')
end
end
alias_method :[], :slice
@@ -434,4 +434,4 @@ module ActiveSupport::Multibyte::Handlers
UCD = UnicodeDatabase.new
end
end
-end \ No newline at end of file
+end