如何用Ruby将Haryāna转换为Haryana

whi*_*eed 1 ruby encoding ascii utf-8

我从api得到这个值,不知怎的,它在值中发送了一些特殊的unicode字符.我想将其转换为普通的ascii字符串.

Abe*_*ker 6

使用unidecodergem:

require 'unidecoder'
"Hary?na".to_ascii # => "Haryana"
Run Code Online (Sandbox Code Playgroud)