Ruby to_yaml utf8 string
How can I make ruby to_yaml method to store utf8 strings with original signs but not escape sequence? ...
How can I make ruby to_yaml method to store utf8 strings with original signs but not escape sequence? ...
According to the YAML documentation it's possible to pass a hash of options to the .to_yaml method. Currently when I pass the options as suggested by the documentation it's not working, the hash is being ignored. irb(main):001:0> require 'yaml' => true irb(main):002:0> user = { "1" => { "name" => "john", "age" => 44 } } user.to_yaml =>...
s = "你好" s.encoding # => #<Encoding:UTF-8> yaml = s.to_yaml # => "--- \"\\xE4\\xBD\\xA0\\xE5\\xA5\\xBD\"\n" yaml.encoding # => #<Encoding:ASCII-8BIT> yaml.force_encoding 'utf-8' # => "--- \"\\xE4\\xBD\\xA0\\xE5\\xA5\\xBD\"\n" Then, how to make the 'to_yaml' generate original looking: "你好", I mean not something ...
im trying to backup my ruby on rails instance as a zip file with yaml files and other attachments in a zip folder. How can i do this? ...