ascii85(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ascii85 β€” the vibe ✨

okay bestie, so this is the ascii85 page from the 3tcl manual, and it's literally about text encoding & decoding binary data. pull up a chair, we're doing this together 🫢


🌸 NAME 🌸

ascii85 β€” ascii85-encode/decode binary data. that's it, that's the whole personality. iconic honestly πŸ’…


✨ SYNOPSIS ✨

package require Tcl 8.5 9

package require ascii85 ?1.1?

::ascii85::encode ?-maxlen maxlen? ?-wrapchar wrapchar? string

::ascii85::decode string

like... three lines and the whole thing is done. main character energy fr fr πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so this package hands you the procedures to encode binary data into ascii85 and then flip it right back. that's the whole deal. no cap.

πŸ’œ ::ascii85::encode ?-maxlen maxlen? ?-wrapchar wrapchar? string

this one ascii85-encodes the binary string you hand it and gives you back the encoded result. it also slips the character wrapchar in every maxlen characters of output, like a lil breath between words.

  • wrapchar defaults to newline
  • maxlen defaults to 76
okay so listen πŸ‘€ Note well: if your string isn't simple ascii, you gotta fix the string encoding before you do the ascii85 encoding. do not skip this step bestie, it will bite you. there's an example below showing exactly how it's done πŸ’–

and the drama clause: the command will throw an error if maxlen is negative, or if maxlen is not an integer number. so like, be normal about it please 😭

🌈 ::ascii85::decode string

this one ascii85-decodes the string and hands you back the binary data. and it's chill about formatting β€” the decoder ignores whitespace in the string, and also tabs and newlines. she does not care. she is unbothered. periodt ✨


πŸŽ€ EXAMPLES πŸŽ€

get ready, these are so satisfying:

% ascii85::encode "Hello, world"
87cURD_*#TDfTZ)
% ascii85::encode [string repeat xyz 24]
G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G
^4U[H$X^\H?a^]
% ascii85::encode -wrapchar "" [string repeat xyz 24]
G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]

see the difference? set -wrapchar "" and suddenly it's one long gorgeous unbroken line. slay πŸ’…

and here's the encoding situation, the one from the note up there:

# NOTE: ascii85 encodes BINARY strings.
% set chemical [encoding convertto utf-8 "C\u2088H\u2081\u2080N\u2084O\u2082"]
% set encoded [ascii85::encode $chemical]
6fN]R8E,5Pidu\UiduhZidua
% set caffeine [encoding convertfrom utf-8 [ascii85::decode $encoded]]

look at that. encoding convertto on the way in, encoding convertfrom on the way out, and ascii85 just vibing in the middle. that's the whole move 🧚


πŸ’« REFERENCES πŸ’«

(reading list bestie, go off πŸ“š)


πŸ™ˆ BUGS, IDEAS, FEEDBACK πŸ™ˆ

okay so real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. obviously. it's software.

please report them in the category base64 of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. and while you're there β€” if you have any ideas for enhancements for either the package and/or the documentation, report those too! we want them 🫢

when you propose code changes, please provide unified diffs, i.e the output of diff -u.

also note further: attachments are strongly preferred over inlined patches. to make an attachment, go to the Edit form of the ticket immediately after its creation, and then use the left-most button in the secondary navigation bar. iykyk 🎯

⭐ KEYWORDS ⭐

ascii85, encoding


πŸ’… CATEGORY πŸ’…

Text processing


Copyright (c) 2010, Emiliano GavilΓ‘n


and that's the whole page bestie!! πŸ’– this came from tcllib, version 1.1.1, and it's the ascii85(3tcl) manual β€” so next time you need to smoosh binary data into printable characters, you know exactly where to go. go encode something gorgeous. mwah πŸŽ€βœ¨πŸŒΈ

πŸ“¦ where this page comes from