dasel icon indicating copy to clipboard operation
dasel copied to clipboard

Incorrect escaping of XML special characters

Open pokle opened this issue 1 year ago • 0 comments

dasel appears to not escape XML special characters like <, > and & when emiting XML.

For example, echo '{"<": "<", ">": ">", "&": "&"}' | dasel -r json -w xml emits:

<doc>
  <&>&</&>
  <<><</<>
  <>>></>>
</doc>

which is invalid XML. Even dasel can't parse it again:

echo '{"<": "<", ">": ">", "&": "&"}' | dasel -r json -w xml | dasel -r xml
Error: could not unmarshal data: xml.Decoder.Token() - XML syntax error on line 2: expected element name after <

pokle avatar Aug 22 '24 04:08 pokle