From: Alexey Petrushin Date: 2011-04-09T11:53:47+09:00 Subject: Re: to_yaml in utf-8 encoding Thanks for Your help, > prog.rb:2:in `
': undefined method `to_yaml' for "alex":String strange, but maybe there are the "require 'yaml'" statement missing? > To encode all strings in your source file in UTF-8, put this line at the > top of your program: > # encoding: utf-8 Yes, I heard of this, You can also use this shortcut to do that: export RUBYOPT="-Ku -rrubygems" > A round trip through yaml works for UTF-8 encoded strings in ruby 1.8.7. > In the program below, my original string contains a euro symbol, and > after a roundtrip through yaml, I get the same string back. Sorry, I don't understand it, You shown that the cryptic output of YAML can be loaded back to normal object. But in my situation it's not enough, I need not ony load it back later but it also should be readable in it's marshalled form. I need to modify thouse *.yaml configs by hand, so those cryptic stuff like "\xE2\x82\xAC" in *.yaml files is unacceptable. -- Posted via http://www.ruby-forum.com/.