Pawe Radecki wrote:
>> install the ya2yaml gem and use "ٵ007".ya2yaml instead of .to_yaml
>>     
>
> I really hoped this worked but it didn't for 100%.
>
> Here is what I did:
> I installed ya2yaml gem using "gem install ya2yaml" command (Windows
> box) and "sudo gem install ya2yaml" Linux box. Got: ya2yaml-0.26.
>
> Then I modified my simple program to be:
> #!/usr/bin/env ruby
>
> require 'yaml'
> require 'ya2yaml'
> require 'jcode'
> $KCODE = 'u'
>
> # show "James Bond 007: Nightfire" text
> # in Chinese in YAML form
> puts 'ٵ007'.ya2yaml
>
> and ran it both on my Windows and Linux boxes.
>
> Windows: When I redirect results to a file (running "yaml_test.rb >
> test.yaml") it works perfectly but when I try to display results on a
> screen (running "yaml_test.rb") with 65001 active code page (set
> through "chcp 65001" in command line) I see:
> (squares)007(squares) and an error message: "in 'write' Bad file
> descriptor (Errno::EBADF)".
>
> Linux: While running above program I get:
> "./yaml_test.rb:4:in `require': no such file to load -- ya2yaml
> (LoadError) from ./yaml_test.rb:4"
>
> Any clue how to work around this?
> Any help much appreciated!
>
> --
> Pawe Radecki
> e: pawel.j.radecki / gmail.com
> w: http://radeckimarch.blogspot.com/
>
>   

Use

require 'rubygems'

before

require 'ya2yaml'


-Justin