aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-03-17 00:54:42 -0700
committerwycats <wycats@gmail.com>2010-03-17 00:54:42 -0700
commit7a83abe52fd982c2b34e8026f3ae34664ad60bc6 (patch)
tree4acd44ce40ee157a11a9da345245727a092dcaef /activesupport
parent640ee5b68d1078fc164bd4e10c019f284ad9b760 (diff)
downloadrails-7a83abe52fd982c2b34e8026f3ae34664ad60bc6.tar.gz
rails-7a83abe52fd982c2b34e8026f3ae34664ad60bc6.tar.bz2
rails-7a83abe52fd982c2b34e8026f3ae34664ad60bc6.zip
Any reason we can't just use the slow 1.8 path for transliteration in 1.9?
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/inflector/transliterate.rb4
-rw-r--r--activesupport/test/inflector_test_cases.rb16
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",