First of all, thanks for this library. It's been great and has got me out of some sticky situations where serde is not flexible enough. Much appreciated.
This PR makes a change to ensure typing between loading and emitting.
Problem
Consider the following YAML:
example: "0x00"
After one round of YamlLoader -> YamlEmitter the YAML is now:
example: 0x00
After a second round the YAML is then:
example: 0
The YAML has now changed significantly and information has been lost.
Solution
I added an emitter.escape_all_strings(bool) function which forces all YAML::String nodes to be wrapped in double-quotes.
I would be interested on your opinion on two points:
I would have used single-quotes, however it seemed much simpler to use double-quotes. I am not a YAML expert and I would be interested to hear of any side-effects.
The key is now wrapped in double-quotes too (e.g., "example": "0x00"). I am not sure if this has side-effects too.
Thank you for you time, happy to make changes as you require.
First of all, thanks for this library. It's been great and has got me out of some sticky situations where
serde
is not flexible enough. Much appreciated.This PR makes a change to ensure typing between loading and emitting.
Problem
Consider the following YAML:
After one round of
YamlLoader -> YamlEmitter
the YAML is now:After a second round the YAML is then:
The YAML has now changed significantly and information has been lost.
Solution
I added an
emitter.escape_all_strings(bool)
function which forces allYAML::String
nodes to be wrapped in double-quotes.I would be interested on your opinion on two points:
"example": "0x00"
). I am not sure if this has side-effects too.Thank you for you time, happy to make changes as you require.