From 73f72eeec2d0cc689735f52de4a5c3c80c4c1e85 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sun, 5 Aug 2007 00:51:16 +0000 Subject: Make the utf-handler return the correct value for non-matching regular expressions. Closes #9049 [manfred] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7273 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb b/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb index 6ca043ae21..e4ef98f1b6 100644 --- a/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb +++ b/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb @@ -316,8 +316,8 @@ module ActiveSupport::Multibyte::Handlers #:nodoc: # Used to translate an offset from bytes to characters, for instance one received from a regular expression match def translate_offset(str, byte_offset) - return 0 if str == '' return nil if byte_offset.nil? + return 0 if str == '' chunk = str[0..byte_offset] begin begin -- cgit v1.2.3