diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2015-02-28 09:10:53 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2015-02-28 09:10:53 -0500 |
commit | c4551a5bbb2c4e0f2c321e3da5e019b054bbfa9e (patch) | |
tree | 9afe6e42b87d0b427794681098a2123698e7d8b9 /activesupport/lib/active_support/core_ext | |
parent | 8af9e1b214059b0c4aba4c4313a37483b21a8fbf (diff) | |
parent | dde6ee9e9b4c04aa56350b34ae74bb0ad0cf8420 (diff) | |
download | rails-c4551a5bbb2c4e0f2c321e3da5e019b054bbfa9e.tar.gz rails-c4551a5bbb2c4e0f2c321e3da5e019b054bbfa9e.tar.bz2 rails-c4551a5bbb2c4e0f2c321e3da5e019b054bbfa9e.zip |
Merge pull request #19124 from davydovanton/add-doc-for-is-utf8
[skip ci] Add documentation for String#is_utf8? method
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/multibyte.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/multibyte.rb b/activesupport/lib/active_support/core_ext/string/multibyte.rb index 2eedd4fdb1..57d7f8d1e7 100644 --- a/activesupport/lib/active_support/core_ext/string/multibyte.rb +++ b/activesupport/lib/active_support/core_ext/string/multibyte.rb @@ -35,6 +35,13 @@ class String ActiveSupport::Multibyte.proxy_class.new(self) end + # Return +true+ if string has utf_8 encoding. + # + # utf_8_str = "some string".encode "UTF-8" + # iso_str = "some string".encode "ISO-8859-1" + # + # utf_8_str.is_utf8? # => true + # iso_str.is_utf8? # => false def is_utf8? case encoding when Encoding::UTF_8 |