<< | Index | >>
export oddb.yaml only (no export job.)
ch.oddb> YamlExporter.new(self).export
oddb.yalm should have about 24000 products
ch.oddb> a = 0; companies.values.each {|c| a += c.packages.length }; p a; -> 24850
YAML syck engine dose not have support for UTF-8 (without ascii).
In Psych engine, If yaml data has unicode String as ascii, it is replaced as binary
.
... # FIXME: remove this method once "to_yaml_properties" is removed ... warn "#{loc}: to_yaml_properties is deprecated, please implement \"encode_with(coder)\"" ...
I could re-create and confirm replaced binary problem with using encode_with
in this sample script.
Attach:yaml_dump_test-20120619.txt
--- - Grüße - Öl - Käse - !ruby/Test:Foo foo: föö bar: !ruby/Test:Bar bar: !binary |- YsOkcg==
def encode_with(coder=nil) self::class::EXPORT_PROPERTIES.each do |a| value = instance_variable_get(a) if value.is_a? String if value.encoding.to_s.downcase != 'utf-8' value.force_encoding('utf-8') end end coder[a[1..-1]] = value end coder.tag = self.to_yaml_type end
module Psych module Visitors class YAMLTree < Psych::Visitors::Visitor def binary? string false end private :binary? end end end
Attach:yaml_dump_test-20120619-2.txt
This way works with sample script.
But it does not work for ODBA::Stub.
Object has gone what has binary data.