Always emit numberish strings with quotes
Lee Read
Branch: leeread/snakeyaml:lread-quote-numberish-strings
Branch: snakeyaml/snakeyaml:master
Merged
Merged pull request
Always emit numberish strings with quotes
Always emit numberish strings with quotes
It is perfectly valid to emit most strings without quotes in YAML 1.1.
For example string 083 can be emitted as 083. Although it starts with a zero, it is not valid octal, and therefore must be a string and can be emitted without quotes.
But a problem will occur if this unquoted 083 is read by some YAML 1.2 parsers, they will read it as integer 83. To appease these parsers, snakeyaml now emits any string that starts with a 0 and looks numberish with quotes.
This means that string 083 will be emitted as '083'.
Addresses #554