Transliteration with Iconv in Ruby

前端 未结 3 946
礼貌的吻别
礼貌的吻别 2021-01-12 10:01

When I\'m trying to transliterate a Cyrillic utf-8 string with

Iconv.iconv(\'ascii//ignore//translit\', \'utf-8\', string).to_s

(see questi

3条回答
  •  广开言路
    2021-01-12 10:37

    require 'iconv'
    p Iconv.iconv('ascii//translit//ignore', 'utf-8',  'Gévry') #=> ["Gevry"]
    # not         'ascii//ignore//translit'
    

    For Cyrillic the translit gem might work.

提交回复
热议问题