Skip to content

Perfect roundtrips on plaintext snapshots #130

@jackmatt2

Description

@jackmatt2

Discussed in #129

Originally posted by nedtwigg December 11, 2022
I think it's important for plaintext snapshots to have perfect roundtrips. That means that it's okay if the encoded text isn't exactly the same as the original text, but when decoded it should be exactly the same again, including newlines. I can see a good argument for removing all \r from snapshots though...

Dumb example: if you change every character into open paren unicode number hex close parent so that A becomes (41), that encoding is bad, but lossless. You get back exactly what you put in.

By picking rare characters for the brackets and escape characters, you get an encoding which is almost always just the text on its own, but in the rare case that you need to escape some characters to encode, you can still perfectly decode.

I dumped some example code which does encoding of that type into #126, feel free to use it if you'd like.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions