⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (598 Bytes)
Bug #5176
» test.rb
hannibal (Masafumi Kiribayashi)
, 08/09/2011 05:17 PM
# coding: cp932
require
'psych'
require
'yaml'
#Encoding.default_internal = Encoding::CP932
=begin
module Psych
module Visitors
class YAMLTree
alias :_visit_String :visit_String
def visit_String o
_visit_String(o.encode(Encoding::UTF_8))
end
end
end
module Nodes
class Node
alias :_to_yaml :to_yaml
def to_yaml io = nil
_to_yaml(io).tap {|v| v.force_encoding(Encoding::UTF_8) if v.kind_of?(String) }
end
end
end
end
=end
v
=
{
"a"
=>
"??"
}
s
=
YAML
::
dump
(
v
)
v
=
YAML
::
load
(
s
)
puts
v
[
"a"
].
encode
(
Encoding
.
locale_charmap
)
(1-1/1)
Loading...