Saving UTF-8 characters to YAML
程序员文章站
2024-03-11 17:33:19
...
require'yaml'
require'rubygems'
require'ya2yaml'
$KCODE = "u"
hash_with_utf8_value = {:key => "一串UTF-8字符..."}
puts hash_with_utf8_value.to_yaml
puts hash_with_utf8_value.ya2yaml
p(YAML.load hash_with_utf8_value.ya2yaml)