我的泰语字符串是:“หลับตาฝัน ถึงชื่อเธอ”
我需要像这样输出utf-8编码:“\u0e08\u0e2d\u0e21\u0e40\u0e27\u0e17\u0e22\u0e4c\u0e21\u0e2b\u0e32”
目前,我安装了“iconv”gem并正在使用
string = Iconv.conv('unicode', 'utf-8', string)
但它不起作用。
invalid encoding ("unicode", "utf-8") (Iconv::InvalidEncoding)
我需要使用 Iconv 还是编码?(我在 Ruby 2.3.1 上)