Returns the KC normalization of the string by default. NFKC is considered
the best normalization form for passing strings to databases and
validations.
form - The form you want to normalize in.
Should be one of the following: :c,:kc,:d, or
:kd. Default is
ActiveSupport::Multibyte::Unicode.default_normalization_form
# File activesupport/lib/active_support/multibyte/chars.rb, line 144
def normalize(form = nil)
form ||= Unicode.default_normalization_form
# See https://www.unicode.org/reports/tr15, Table 1
if alias_form = Unicode::NORMALIZATION_FORM_ALIASES[form]
ActiveSupport::Deprecation.warn( ActiveSupport::Multibyte::Chars#normalize is deprecated and will be removed from Rails 6.1. Use #unicode_normalize(:#{alias_form}) instead..squish)
send(:unicode_normalize, alias_form)
else
ActiveSupport::Deprecation.warn( ActiveSupport::Multibyte::Chars#normalize is deprecated and will be removed from Rails 6.1. Use #unicode_normalize instead..squish)
raise ArgumentError, "#{form} is not a valid normalization variant", caller
end
end