欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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)
相关标签: rubygems Ruby