Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perfect roundtrips on plaintext snapshots #130

Open
jackmatt2 opened this issue Dec 11, 2022 Discussed in #129 · 1 comment
Open

Perfect roundtrips on plaintext snapshots #130

jackmatt2 opened this issue Dec 11, 2022 Discussed in #129 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jackmatt2
Copy link
Member

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.

@jackmatt2 jackmatt2 added the enhancement New feature or request label Dec 11, 2022
@jackmatt2 jackmatt2 self-assigned this Dec 11, 2022
@jackmatt2
Copy link
Member Author

Also need to escape characters in the header so that =, [, ] characters can be used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant