Yaml parser fails when value contains tab

Issue #759 new
Alex Spurling created an issue

The Okapi Yaml parser fails to parse the following yaml:

foo:
  bar: "one two"

With the following error:

net.sf.okapi.common.exceptions.OkapiBadFilterInputException: Error parsing YAML file: Lexical error at line 2, column 12. Encountered: "\t" (9), after : ""

However, the following yaml parses successfully:

foo:
  bar: 'one two'

Is it a bug that values cannot contain tabs? If not, why are they allowed in single quoted values but not double quoted values?

Example code:

    @Test
    public void testYamlWithTab() {
        String yaml = "foo:\n  bar: \"one\ttwo\"\n";
        YamlFilter yamlFilter = new YamlFilter();
        yamlFilter.open(new RawDocument(yaml, LocaleId.ENGLISH));
    }

I am using the latest version of 0.37 snapshot of the yaml library.

Note: Both the 1.1 and 1.2 Yaml specs explicitly allow tab characters in scalar values.

Comments (1)

  1. Log in to comment