diff options
author | Damien Mathieu <42@dmathieu.com> | 2011-07-19 12:22:31 +0200 |
---|---|---|
committer | Damien Mathieu <42@dmathieu.com> | 2011-07-20 11:23:00 +0200 |
commit | 0c58f39c2c7ff590e854772e41f6d10117a51c53 (patch) | |
tree | 5de7567310d026bc8026956c63c6e53802947607 | |
parent | 73efb68dc9cbecaad81598d6653cb3bb1927a40d (diff) | |
download | rails-0c58f39c2c7ff590e854772e41f6d10117a51c53.tar.gz rails-0c58f39c2c7ff590e854772e41f6d10117a51c53.tar.bz2 rails-0c58f39c2c7ff590e854772e41f6d10117a51c53.zip |
fix String#blank? on binary strings.
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/blank.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb index d060ac04d8..5556546822 100644 --- a/activesupport/lib/active_support/core_ext/object/blank.rb +++ b/activesupport/lib/active_support/core_ext/object/blank.rb @@ -99,7 +99,12 @@ class String # " something here ".blank? # => false # def blank? - self !~ NON_WHITESPACE_REGEXP + # 1.8 does not takes [:space:] properly + if encoding_aware? + self !~ /[^[:space:]]/ + else + self !~ NON_WHITESPACE_REGEXP + end end end |