UcasRichard / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

Can not properly load/save multilined String #163

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Not loading:
1. See example: http://www.hastebin.com/hukatihiqi.vhdl
2. Load multiline text that uses a '|'
3. Read the loaded String, it has an additional newline (\n)

What is the expected output? What do you see instead?
No trailing newline. I see a trailing newline.

Not saving:
1. See example: http://www.hastebin.com/kehurujeva.vhdl
2. Save multiline text
3. See the result, it has additional newlines in the text
4. Try loading this again - doesn't work

What is the expected output? What do you see instead?
I expect a node with '|' and then the lines that were saved. Instead I see 
'-surrounded text with gaping holes that fail to load again

What version of SnakeYAML are you using? On what Java version?
snakeyaml v1.9. (Used in the CraftBukkit minecraft server)
Java version 7 (also happens on Java 6)

Please provide any additional information below. (Often a failing test is
the best way to describe the problem.)
Nothing.

Original issue reported on code.google.com by bergerki...@gmail.com on 5 Dec 2012 at 11:44

GoogleCodeExporter commented 9 years ago
The line break following the final non-empty literal line is subject to 
chomping:
http://yaml.org/spec/1.1/#id928909

Clipping is the default behaviour used if no explicit chomping indicator is 
specified:
http://yaml.org/spec/1.1/#chomping/

Please be aware that the example contains the trailing line break after line 2.
If you wish to exclude this trailing line break you may use strip chomping, as 
shown in this example (which was just created):
http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyam
l/issues/issue163/LinearScalaTralingTest.java

Original comment by py4fun@gmail.com on 5 Dec 2012 at 3:58

GoogleCodeExporter commented 9 years ago
Since there is no clarification from the reporter, the issue is closed

Original comment by py4fun@gmail.com on 22 Jan 2013 at 5:20