Permalink
Browse files

fix String#blank? on binary strings.

  • Loading branch information...
1 parent 73efb68 commit 0c58f39c2c7ff590e854772e41f6d10117a51c53 @dmathieu dmathieu committed Jul 19, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 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

0 comments on commit 0c58f39

Please sign in to comment.