Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Iconv.iconv('asccii//translit', 'utf-8', 'Těžiště')
- ActiveSupport::Multibyte::Unicode.normalize('Těžiště', :kd).chars.grep(/p{^Mn}/).join('')
- > UnicodeUtils.compatibility_decomposition('Těžiště').chars.grep(/p{^Mn}/).join('')
- => "Teziste"
- def de_accent
- #
- # `p{Mn}` is also known as `p{Nonspacing_Mark}` but only the short
- # and cryptic form is documented.
- #
- ActiveSupport::Multibyte::Unicode.normalize(self, :kd).chars.grep(/p{^Mn}/).join('')
- end
- > s = 'Těžiště'.de_accent
- => "Teziste"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement