Changeset 7273
- Timestamp:
- 08/05/07 00:51:16 (1 year ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb (modified) (1 diff)
- trunk/activesupport/test/multibyte_chars_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r7272 r7273 1 1 *SVN* 2 3 * Make the utf-handler return the correct value for non-matching regular expressions. Closes #9049 [manfred] 2 4 3 5 * Add ljust, rjust and center to utf8-handler. Closes #9165 [manfred] trunk/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
r7272 r7273 317 317 # Used to translate an offset from bytes to characters, for instance one received from a regular expression match 318 318 def translate_offset(str, byte_offset) 319 return nil if byte_offset.nil? 319 320 return 0 if str == '' 320 return nil if byte_offset.nil?321 321 chunk = str[0..byte_offset] 322 322 begin trunk/activesupport/test/multibyte_chars_test.rb
r6882 r7273 82 82 assert_equal 9, (@s[:utf8].chars =~ /ï¬/), 83 83 "Regex matching should be unicode aware" 84 assert_nil((''.chars =~ /\d+/), 85 "Non-matching regular expressions should return nil") 84 86 end 85 87 end … … 119 121 def test_passthrough_on_kcode 120 122 # The easiest way to check if the passthrough is in place is through #size 121 with_kcode('non ce') do123 with_kcode('none') do 122 124 assert_equal 26, @s[:utf8].chars.size 123 125 end