views:

34

answers:

1

Hi Guys,
I have loaded a string from a html.file, and I have writen it to a yaml file with the plugin ya2yaml:


- title: 'What a wonderful day!'
  body:  ... # main contents here

and I will load the .yml file by YAML::parse_file method.
but "\n" in the string will cause load problems, so I tried to gsub all "\n" to "", but there is still problems, a char '0083'(I see it in the terminal) still breaks the line, and cause loading problem:


in `load': syntax error on line 32, col 6: `      </strong><br>ok ' (ArgumentError)
from /home/croplio/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/syck.rb:178:in `parse'
from /home/croplio/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/syck.rb:203:in `block in parse_file'
from /home/croplio/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/syck.rb:202:in `open'

So what's wrong with the yaml or the char 0083?
or how can I avoid this problem?

A: 

0083 is a unicode character 'NO BREAK HERE'. I don't know YAML::pars, but maybe you can switch it to use unicodes or use pure ascii codes.

vurte