diff options
-rw-r--r-- | activesupport/lib/active_support/inflector/transliterate.rb | 4 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 16 |
2 files changed, 6 insertions, 14 deletions
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb index 236f2eb628..2ce27cf406 100644 --- a/activesupport/lib/active_support/inflector/transliterate.rb +++ b/activesupport/lib/active_support/inflector/transliterate.rb @@ -14,8 +14,8 @@ module ActiveSupport if RUBY_VERSION >= '1.9' undef_method :transliterate def transliterate(string) - warn "Ruby 1.9 doesn't support Unicode normalization yet" - string.dup + proxy = ActiveSupport::Multibyte.proxy_class.new(string) + proxy.normalize(:kd).gsub(/[^\x00-\x7F]+/, '') end # The iconv transliteration code doesn't function correctly diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index ebd26d3fc6..56372903f3 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -180,18 +180,10 @@ module InflectorTestCases "Test with + sign" => "test_with_sign" } - # Ruby 1.9 doesn't do Unicode normalization yet. - if RUBY_VERSION >= '1.9' - StringToParameterizedAndNormalized = { - "Malmö" => "malm", - "Garçons" => "gar-ons" - } - else - StringToParameterizedAndNormalized = { - "Malmö" => "malmo", - "Garçons" => "garcons" - } - end + StringToParameterizedAndNormalized = { + "Malmö" => "malmo", + "Garçons" => "garcons" + } UnderscoreToHuman = { "employee_salary" => "Employee salary", |