public
Fork of kakutani/yaml_waml
Description: Rails plugin to workaround for fixing output result of 'to_yaml' method treats multibyte UTF-8 string(such as japanese) as binary.
Homepage: http://code.google.com/p/yaml-waml/
Clone URL: git://github.com/ohac/yaml_waml.git
Support YAML.dump
OHASHI Hideya (author)
Mon Sep 01 04:28:20 -0700 2008
commit  0d111b954fc251973701dbc1504302c2c5b9a2f8
tree    af0939c9534a4a60210dab32bfa9743ed4787826
parent  72ff5ac7c1891686d7506d665b373bbe375b8446
...
15
16
17
 
 
 
 
 
 
 
18
19
20
...
15
16
17
18
19
20
21
22
23
24
25
26
27
0
@@ -15,6 +15,13 @@ ObjectSpace.each_object(Class) do |klass|
0
           # decode for workaround
0
           result.gsub(/\\x(\w{2})/){
0
             [Regexp.last_match.captures.first.to_i(16)].pack("C")}
0
+        elsif result.kind_of? StringIO
0
+          str = result.string
0
+          str.gsub!(/\\x(\w{2})/){
0
+            [Regexp.last_match.captures.first.to_i(16)].pack("C")}
0
+          result.rewind
0
+          result.write str
0
+          result
0
         else
0
           result
0
         end

Comments

kakutani Tue Sep 02 02:08:56 -0700 2008

thank you for hacking. I’ve applied your patch (and yaml_waml is gemized. http://github.com/kakutani/yaml_waml/commit/72e708201f52ab434a4e4f5597574461aaf5b80b