Base85 (Ascii85) Encoder / Decoder
NewEncode and decode data using Ascii85/Base85, as used in PDF and PostScript.
Adobe Ascii85 packs 4 bytes into 5 printable characters and appears in PDF and PostScript data streams.
Frequently Asked Questions
Is this Adobe Ascii85, and do I need the <~ ~> wrappers?
Yes, it's Adobe-style Ascii85. Encoding can optionally wrap the output in <~ and ~>, and the decoder accepts either wrapped or unwrapped input.
Why did the encoder turn part of my output into a single 'z'?
That's intentional Ascii85 shorthand for a full 4-byte zero block. This component emits 'z' during encode when a complete 4-byte chunk is all zeroes.
Why does decode fail when I put 'z' in the middle of another group?
Because the tool only allows 'z' between full 5-character groups. If there's already a partial group in progress, it throws a specific error instead of guessing what you meant.
Can I paste Ascii85 with spaces and line breaks from a PDF stream?
Yes. The decoder strips all whitespace before parsing, so wrapped or line-broken Ascii85 text is fine. It also handles partially padded final groups the standard way.
Can I use this for arbitrary binary blobs?
Only if the decoded bytes form valid UTF-8 text. The component decodes output through TextDecoder in fatal mode, so raw binary that isn't valid UTF-8 will error instead of producing byte escapes.