From: Michael Fellinger Date: 2008-04-08T21:29:15+09:00 Subject: Re: Saving UTF-8 characters to YAML problem On Tue, Apr 8, 2008 at 12:25 AM, Paweł Radecki wrote: > Hi there, > > I'm trying to save multinational data to YAML with following simple > program: > > require 'yaml' > > # show "James Bond 007: Nightfire in Chinese" > # text in YAML form > puts '詹姆斯邦德007:暗夜之火'.to_yaml > > and what I get is: > --- "\xE8\xA9\xB9\xE5\xA7\x86\xE6\x96\xAF\xE9\x82\xA6\xE5\xBE > \xB7007\xEF\xBC\x9A\xE6\x9A\x97\xE5\xA4\x9C\xE4\xB9\x8B\xE7\x81\xAB" > > How can I make this to be human readable text? > install the ya2yaml gem and use "詹姆斯邦德007:暗夜之火".ya2yaml instead of .to_yaml The problem with the yaml that comes with ruby is that it doesn't have good unicode support, so any "strange" text will be saved as binary, that behaviour exists since around 1.8.5. You don't have to change the way your YAML is read, but you have to use ya2yaml for serializing. ^ manveru