From 0c58f39c2c7ff590e854772e41f6d10117a51c53 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Tue, 19 Jul 2011 12:22:31 +0200 Subject: fix String#blank? on binary strings. --- activesupport/lib/active_support/core_ext/object/blank.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext') 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 -- cgit v1.2.3