HomePhorge

Implement YAML 1.1 binary data encoding in ZAML
ea0dd1483fc2Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Implement YAML 1.1 binary data encoding in ZAML

The YAML spec has a mechanism to flag arbitrary binary data, as opposed to
sequences of Unicode characters in UTF-8. This implements full support for
that in the ZAML encoder.

This is used on the basis of a string that doesn't contain valid UTF-8.
Another stinking heuristic, but at least one that results in conformant YAML
being emitted.

Pleasantly, the !binary tagged data is correctly ready by Syck as far back as
Ruby 1.8.5, allowing us to confidently ship this data without too much concern
for compatibility with older libraries.

Additionally, we stop escaping all UTF-8 data as a sequence of bytes.
Theoretically we could go back to escaping it, using real Unicode character
markers, but literal UTF-8 in the output file is just as acceptable.

This should gain better support for the Ruby 1.9 encoding markers, so that
strings could carry their binary or non-binary nature in ... but this gets
things working and passes both Unicode and Binary data tests.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU2e9460d02b52: Partially fix UTF-8 and PSON encoding tests for Ruby 1.9
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPUea0dd1483fc2: Implement YAML 1.1 binary data encoding in ZAML (authored by Daniel Pittman <daniel@puppetlabs.com>).Mar 30 2012, 9:15 PM