lib/active_support/multibyte/chars.rb in activesupport-2.0.1 vs lib/active_support/multibyte/chars.rb in activesupport-2.0.2
- old
+ new
@@ -117,11 +117,17 @@
private
# +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
# When we can load the utf8proc library, override normalization with the faster methods