wire / encoding / ascii85

Ascii85 (Adobe / btoa base-85)

Ascii85 packs every 4 input bytes (a 32-bit big-endian value) into 5 printable ASCII characters from '!'(0x21) to 'u'(0x75), giving ~25% expansion versus Base64's ~33%. An all-zero 4-byte group is abbreviated to the single character 'z'. A final partial group of n bytes encodes to n+1 characters. It backs PostScript and PDF (where the stream is wrapped in '<~' ... '~>').

encoding kind encoding status de-facto verification verified tier B encoding@1

aka: base85 · base-85 · Adobe Ascii85 · btoa

test vectors

Adobe Ascii85 (PostScript / PDF) — base-85 · alphabet: ASCII bytes 0x21 ('!') through 0x75 ('u'); base-85 digit d maps to the character (d + 33)

inputoutputnote
utf8 ascii Empty input -> empty output.
Man ascii 9jqo^ ascii Canonical example: the 4 bytes "Man " (0x4D616E20) -> "9jqo^".
sure. ascii F*2M7/c ascii 5 bytes -> one full group (5 chars) + a 1-byte tail (2 chars) = 7 chars.
00000000 bytes-hex z ascii Zero-group shortcut: a full 0x00000000 group encodes to the single character 'z'.
9jqo^ ascii Man ascii Round-trip: ascii85-decode("9jqo^") = "Man ".

provenance

see also

agent: curl -H 'accept: application/json' wire.phall.io/encoding/ascii85 or /encoding/ascii85.json