You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Marshalling/Encoding a scalar YAML node with the folded multi-line style I see an unexpected new line in the encoded YAML.
I've added some test cases in a branch in my fork.
A yaml.Node with style.Folded and the following Value:
foo
bar
Is marshalled with a newline between foo and bar:
>-
foo
bar
I'm expecting it to be marshalled as follows:
>-
foo
bar
Reading the spec I believe my expectations are correct.
Lines starting with white space characters (more-indented lines) are not folded.
The snippet Example 8.10. Folded Lines shows an indented line and it does not include the additional newline.
The impact of this is that marshalling unmarshalling a YAML string into a YAML node and back into a string again does not result in the same string value within the node.
The text was updated successfully, but these errors were encountered:
When using:
>-
someline
more
The encoder would emit:
>-
someline
more
The issue was introduced in the original translation from C to
Go. In the C code the MOVE macro would advance the start pointer
of the string. In the Go case "k = 0" points to the start of the
string where in the C case it would be the read pointer. Fix it.
Also address bound checks to not go beyond the string (I assume in
the C code there is an explicit NUL or at least some NUL).
Fixes: go-yaml#804
zecke
pushed a commit
to zecke/go-yaml
that referenced
this issue
May 3, 2023
When using:
>-
someline
more
The encoder would emit:
>-
someline
more
The issue was introduced in the original translation from C to
Go. In the C code the MOVE macro would advance the start pointer
of the string. In the Go case "k = 0" points to the start of the
string where in the C case it would be the read pointer. Fix it.
Also address bound checks to not go beyond the string (I assume in
the C code there is an explicit NUL or at least some NUL).
Fixes: go-yaml#804
zecke
linked a pull request
May 3, 2023
that will
close
this issue
When Marshalling/Encoding a scalar YAML node with the folded multi-line style I see an unexpected new line in the encoded YAML.
I've added some test cases in a branch in my fork.
A
yaml.Node
withstyle.Folded
and the followingValue
:Is marshalled with a newline between foo and bar:
I'm expecting it to be marshalled as follows:
Reading the spec I believe my expectations are correct.
The snippet
Example 8.10. Folded Lines
shows an indented line and it does not include the additional newline.The impact of this is that marshalling unmarshalling a YAML string into a YAML node and back into a string again does not result in the same string value within the node.
The text was updated successfully, but these errors were encountered: