aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte/chars.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-15 02:28:20 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-15 02:28:20 +0000
commitaa4ad404c6aa4feccc69b8d7222bcfd1b1903215 (patch)
treef2d665ca4f0ca0be949eb6db96d8b3816dab5600 /activesupport/lib/active_support/multibyte/chars.rb
parentcefea3c677f90b2c095b377f1ba36a3ff157f5b0 (diff)
downloadrails-aa4ad404c6aa4feccc69b8d7222bcfd1b1903215.tar.gz
rails-aa4ad404c6aa4feccc69b8d7222bcfd1b1903215.tar.bz2
rails-aa4ad404c6aa4feccc69b8d7222bcfd1b1903215.zip
Ruby 1.9 compat: shadowed vars, kcode
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8402 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/multibyte/chars.rb')
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index 65114415eb..b30214d947 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -119,8 +119,14 @@ module ActiveSupport::Multibyte #:nodoc:
# +utf8_pragma+ checks if it can send this string to the handlers. It makes sure @string isn't nil and $KCODE is
# set to 'UTF8'.
- def utf8_pragma?
- !@string.nil? && ($KCODE == 'UTF8')
+ if RUBY_VERSION < '1.9'
+ def utf8_pragma?
+ !@string.nil? && ($KCODE == 'UTF8')
+ end
+ else
+ def utf8_pragma?
+ !@string.nil? && (Encoding.default_external == Encoding::UTF_8)
+ end
end
end
end