YAML can not accept "\t" under windows!


#1

when i try this code
ruby -ryaml -e ‘p YAML.load(" — hello")’
it print the “hello”

but when i use
ruby -ryaml -e ‘p YAML.load("\t— hello")’ under my windows
ruby 1.8.2 (2004-12-25) [i386-mswin32]
it print such error

e:/ruby/lib/ruby/1.8/yaml.rb:119:in load': parse error on line 0, col 10:’ (ArgumentError)
from e:/ruby/lib/ruby/1.8/yaml.rb:119:in `load’
from -e:1

but it’s ok under linux , so why yaml can not accept “\t” under windows
?


#2

cap wrote:

when i try this code
ruby -ryaml -e ‘p YAML.load(" — hello")’
it print the “hello”

but when i use
ruby -ryaml -e ‘p YAML.load("\t— hello")’ under my windows
ruby 1.8.2 (2004-12-25) [i386-mswin32]
it print such error

Which proves that if you try hard enough to break something,
you’ll probably succeed.

Where in the specification does it say that should work?
http://yaml.org/spec/current.html#id2525905

It’ll work on 1.8.4 but that doesn’t make it part of the spec.

daz


#3

cap:

but it’s ok under linux , so why yaml can not accept “\t” under windows ?

It doesn’t under Linux either. YAML does not like tabs.

Malte


#4

I meet the same problem when using rubyonrails
the webrick produce strange
“Invalid char `\003’ in expression”
error in the page when the rhtml file contains table character(use
TABLE to input a character using editplus or radrais)

has anyone met the same problem? :((


#5

5 min ago, I realized that the ruby version in my linux server is
1.8.3.
So I upgrade my windows ruby version to 1.8.3 ms-win32

Now ,the YAML can accept “\t” and the rails works very good :slight_smile:

but i still doesn’t know the reason…


#6

Hello.

cap:

Now, the YAML can accept “\t” and the rails works very good :slight_smile:
but i still doesn’t know the reason…

http://yaml.org/faq.html has one question only,
that question being ‘Why does YAML forbid tabs?’ :o)

Cheers,
– Shot