This was sent to me, but was probably meant for there mailing list:

Begin forwarded message:

From: Ingy dot Net <>
Subject: Re: [Yaml-core] Tabs inside scalars
Date: 2011-12-17 20:01:59 GMT+01:00
To: Uwe Kubosch <>

a tab in the middle of a plain scalar should be allowed.

Interestingly, the Perl binding of libyaml handles it fine, while the python version fails:

> perl -MYAML::XS -e 'print Dump Load "x\tx"'
--- "x\tx"

> python -c 'import yaml;print yaml.dump(yaml.load("x\tx"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/yaml/", line 71, in load
    return loader.get_single_data()
  File "/usr/lib/python2.7/dist-packages/yaml/", line 37, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python2.7/dist-packages/yaml/", line 35, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/usr/lib/python2.7/dist-packages/yaml/", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python2.7/dist-packages/yaml/", line 143, in parse_implicit_document_start
  File "/usr/lib/python2.7/dist-packages/yaml/", line 116, in check_token
  File "/usr/lib/python2.7/dist-packages/yaml/", line 257, in fetch_more_tokens
    % ch.encode('utf-8'), self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
  in "<string>", line 1, column 2:
    x    x


On Thu, Dec 15, 2011 at 3:09 PM, Uwe Kubosch <> wrote:

I have example output from Ruby 1.8 that fails to parse with SnakeYAML:

"36L\tDIESEL" dumped from Ruby 1.8 gives "--- 36L\tDIESEL\n"

When loaded with SnakeYAML it throws an exception:

Exception in thread "main" while scanning for the next token
found character         '\t' that cannot start any token
 in "<string>", line 1, column 8:
   --- 36L     DIESEL

       at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(
       at org.yaml.snakeyaml.scanner.ScannerImpl.peekToken(
       at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentEnd.produce(
       at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(
       at org.yaml.snakeyaml.parser.ParserImpl.getEvent(
       at org.yaml.snakeyaml.composer.Composer.composeDocument(
       at org.yaml.snakeyaml.composer.Composer.getSingleNode(
       at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(
       at org.yaml.snakeyaml.Yaml.loadFromReader(
       at org.yaml.snakeyaml.Yaml.load(

This is currently being tracked at

The question is wether the example is legal YAML.

I have read the specs, and I find them inconclusive.  Ruby 1.8 has been around for a long while, and the use of YAML with Ruby is widespread, being in the standard library and all.  So I assumed that the output is legal YAML and that SnakeYAML should accept it.

Anybody got an answer on this?

Uwe Kubosch
Systems Developer
Datek Wireless AS

10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity.  Learn More!
Yaml-core mailing list

Uwe Kubosch
Systems Developer
Datek Wireless AS