Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Any reason we can't just use the slow 1.8 path for transliteration in…

… 1.9?
  • Loading branch information...
commit 7a83abe52fd982c2b34e8026f3ae34664ad60bc6 1 parent 640ee5b
@wycats wycats authored
View
4 activesupport/lib/active_support/inflector/transliterate.rb
@@ -14,8 +14,8 @@ def transliterate(string)
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
View
16 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",
Please sign in to comment.
Something went wrong with that request. Please try again.