diff options
author | Matthew Draper <matthew@trebex.net> | 2014-09-15 21:41:25 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-09-15 21:41:25 +0930 |
commit | 62955c77bf380fe39005c1a7de8b8fde769af2cd (patch) | |
tree | 87940d31e4c7efdc7ed9edec666889f49a06747d | |
parent | c0a4a300f75a1e63ab3d8d8c31315bf3e456904e (diff) | |
download | rails-62955c77bf380fe39005c1a7de8b8fde769af2cd.tar.gz rails-62955c77bf380fe39005c1a7de8b8fde769af2cd.tar.bz2 rails-62955c77bf380fe39005c1a7de8b8fde769af2cd.zip |
As of Unicode 6.3, Mongolian Vowel Separator is not whitespace
Ruby 2.2 knows this, and no longer matches it with [[:space:]], so it's
not a good candidate for testing String#squish.
4 files changed, 5 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb index 1dfaf76673..2b1583d4ac 100644 --- a/activesupport/lib/active_support/core_ext/string/filters.rb +++ b/activesupport/lib/active_support/core_ext/string/filters.rb @@ -3,7 +3,7 @@ class String # the string, and then changing remaining consecutive whitespace # groups into one space each. # - # Note that it handles both ASCII and Unicode whitespace like mongolian vowel separator (U+180E). + # Note that it handles both ASCII and Unicode whitespace. # # %{ Multi-line # string }.squish # => "Multi-line string" diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb index 89009d1f55..7d45961515 100644 --- a/activesupport/lib/active_support/multibyte/unicode.rb +++ b/activesupport/lib/active_support/multibyte/unicode.rb @@ -42,7 +42,6 @@ module ActiveSupport 0x0085, # White_Space # Cc <control-0085> 0x00A0, # White_Space # Zs NO-BREAK SPACE 0x1680, # White_Space # Zs OGHAM SPACE MARK - 0x180E, # White_Space # Zs MONGOLIAN VOWEL SEPARATOR (0x2000..0x200A).to_a, # White_Space # Zs [11] EN QUAD..HAIR SPACE 0x2028, # White_Space # Zl LINE SEPARATOR 0x2029, # White_Space # Zp PARAGRAPH SEPARATOR diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 18b4727c3b..2f4691817f 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -189,10 +189,10 @@ class StringInflectionsTest < ActiveSupport::TestCase end def test_string_squish - original = %{\u180E\u180E A string surrounded by unicode mongolian vowel separators, - with tabs(\t\t), newlines(\n\n), unicode nextlines(\u0085\u0085) and many spaces( ). \u180E\u180E} + original = %{\u205f\u3000 A string surrounded by various unicode spaces, + with tabs(\t\t), newlines(\n\n), unicode nextlines(\u0085\u0085) and many spaces( ). \u00a0\u2007} - expected = "A string surrounded by unicode mongolian vowel separators, " + + expected = "A string surrounded by various unicode spaces, " + "with tabs( ), newlines( ), unicode nextlines( ) and many spaces( )." # Make sure squish returns what we expect: diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 2e1a3ee5dc..de42f13145 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1268,7 +1268,7 @@ The method `squish` strips leading and trailing whitespace, and substitutes runs There's also the destructive version `String#squish!`. -Note that it handles both ASCII and Unicode whitespace like mongolian vowel separator (U+180E). +Note that it handles both ASCII and Unicode whitespace. NOTE: Defined in `active_support/core_ext/string/filters.rb`. |