Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double-quoted Multi-line string deserialization issue #508

Open
jmcburn opened this issue Jun 26, 2020 · 4 comments
Open

Double-quoted Multi-line string deserialization issue #508

jmcburn opened this issue Jun 26, 2020 · 4 comments

Comments

@jmcburn
Copy link

jmcburn commented Jun 26, 2020

Seems there is a problem with deserializing double-quoted multi-line strings.

Until a few versions this deserialized fine and according to yaml testers this should not be a problem:

Problem:

Description: "Start: [c][FFFFFF]Wreckage Base[-][/c]        Equipment:[c][FFFFFF] Advanced[-][/c]        Tutorial:[c][FFFFFF] No[-][/c]


Lakes, swamps, deep forests, oceans and vast open plains are the geographical characteristics of this temperate planet. With a multitude of mountain ranges with snow-capped peaks, some formed by volcanic activity, others by glacial flow, the climate is moderate and the atmosphere is breathable.
 
  
Recommended for experienced players who do not need the basic tutorial and want to start in a base with advanced equipment."

Now I get the following error:

"While scanning a multi-line double-quoted scalar, found wrong indentation."

When I add indentations to the lines, it works fine:

Description: "Start: [c][FFFFFF]Wreckage Base[-][/c]        Equipment:[c][FFFFFF] Advanced[-][/c]        Tutorial:[c][FFFFFF] No[-][/c]


  Lakes, swamps, deep forests, oceans and vast open plains are the geographical characteristics of this temperate planet. With a multitude of mountain ranges with snow-capped peaks, some formed by volcanic activity, others by glacial flow, the climate is moderate and the atmosphere is breathable.
 
  
  Recommended for experienced players who do not need the basic tutorial and want to start in a base with advanced equipment."

In my experience and as far as my researches went, indentations on follow-up lines of double-quoted multi-line strings are are not necessary.

@markjulmar
Copy link

I'm experiencing the same issue with the latest version. I agree with @jmcburn, according to the 1.2 specification (Example 7.5), double quoted strings are allowed to have line breaks that carry into the expressed content.

@BigBallard
Copy link

I can third this.

@aaubry
Copy link
Owner

aaubry commented Jan 20, 2021

This has been discussed in #557. It turns out that multiline double-quoted scalars must be indented. Attempting to parse this example in the reference parser gives an error as well.
The previous behaviour was incorrect and has been fixed so that the parser is more compliant with the specification.

@jmcburn
Copy link
Author

jmcburn commented Jan 20, 2021

@aaubry I see, but is there a way to make YamlDotNet still being able to read them once and then on writing the yaml again, make it emit those quoted strings in the correct way with indentation?

The problem is that I now have a few hundred, if not thousands of unreadable yamls now, and fixing them by hand might take quite some time.

Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants