Skip to content

Perfect roundtrips on plaintext snapshots #130

Open

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.

Activity

  1. self-assigned this
    on Dec 11, 2022
  2. jackmatt2 commented on Jan 20, 2023

    @jackmatt2
    CollaboratorAuthor

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

  3. added this to the 5.0.0 milestone on Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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