quoted-printable(3trf)

πŸ’– quoted-printable β€” the manual page, but make it make sense ✨

okay bestie, gather round, because today we're learning about quoted-printable, one of the data encodings that ships inside the trf package. if you wanna see the whole package as a vibe, go read trf-intro, it's the group chat's pinned message fr fr 🫢


🌸 NAME 🌸

quoted-printable β€” Encoding "quoted-printable"


✨ SYNOPSIS ✨

package require Tcl  ?8.2?

package require Trf  ?2.1.3?

quoted-printable ?options...? ?data?

πŸ¦‹ DESCRIPTION πŸ¦‹

so the command quoted-printable is literally just one of the several data encodings that the package trf hands you. (again: trf-intro for the whole picture, it's giving syllabus day πŸ’…)

the tea is this: printable ASCII characters are largely untouched. everything else gets a three-character encoding sequence instead. this is MIME's compromise encoding β€” not the cutest name, but it ate. the official definition lives in RFC 2045, which you can go read at http://www.rfc-editor.org/rfc/rfc2045.txt if you're that girl. πŸ“š

quoted-printable ?options...? ?data?

πŸŽ€ the options, one by one, no skipping, we don't do that here

  • -mode encode|decode β€” this one HAS to be there, it's non-negotiable, and the encoding always understands it. no cap.

in immediate mode the argument value tells you which operation to use. for an attached encoding, it tells you the operation used for writing β€” reading will automatically use the reverse operation, slay. (see the section IMMEDIATE versus ATTACHED below for what those two words even mean, bestie.)

beyond the exact argument values listed above, all unique abbreviations are recognized too. so yes, you can be lazy, it's fine.

encode converts from arbitrary (most likely binary) data into the described representation. decode does the reverse. πŸͺž

  • -attach channel β€” the presence or absence of this option is what decides the main operation mode of the transformation. big deal energy.

if it's present, the transformation gets stacked onto the channel whose handle you handed to the option, and it runs in attached mode. more on that in the IMMEDIATE versus ATTACHED section.

if it's absent, the transformation is used in immediate mode, and all the options listed below it become recognized. again: IMMEDIATE versus ATTACHED section. go read it, i'm not mad, i'm just saying. πŸ™ˆ

  • -in channel β€” this option is legal if and only if the transformation is being used in immediate mode. it gives you the handle of the channel that the data to transform has to be read from.

if the transformation is in immediate mode and this option is absent, then the data to transform is expected as the last argument to the transformation itself. okay so basically: file or vibes, pick one.

  • -out channel β€” same deal, legal if and only if the transformation is in immediate mode. it gives you the handle of the channel that the generated transformation result gets written to.

if the transformation is in immediate mode and this option is absent, the generated data is returned as the result of the command itself. cute, right? it just hands it to you.


πŸ”₯ IMMEDIATE VERSUS ATTACHED πŸ”₯

okay so this transformation has two main ways of being used, and they're genuinely different vibes. here's the breakdown:

the attached mode πŸ’…

for attached mode you use the option -attach to associate the transformation with an existing channel. during the execution of the command, no transformation is performed β€” instead, the channel itself gets changed in such a way that from that moment on, all data written to it or read from it passes through the transformation and gets modified by it, according to the definition up above. it's a permanent glow-up for that channel, periodt.

this attachment can be revoked by executing the command unstack for the chosen channel. and heads up bestie: this is the only way to do this at the Tcl level. no other method, don't come looking, there isn't one.

the immediate mode ⚑

in the second mode β€” which you can detect by the absence of the option -attach β€” the transformation immediately takes data from either its commandline or a channel, transforms it, and returns the result either as the result of the command, or writes it into a channel. it's named after the immediate nature of its execution, because obviously. main character energy, no waiting around.

where the data is taken from, and where it's delivered to, is governed by the presence and absence of the options -in and -out.

and now a little historical lore moment πŸ›οΈ β€” it should be noted that this ability to immediately read from and/or write to a channel is an historic artifact. it was introduced at the beginning of Trf's life, back when Tcl version 7.6 was current, because that version and earlier ones had trouble dealing with \0 characters embedded into either input or output. so yeah. ancient. iconic. still here.

🌈 SEE ALSO 🌈

ascii85, base64, bin, hex, oct, otp_words, quoted-printable, trf-intro, uuencode

(go read them, they're all baddies in their own way 🫢)


⭐ KEYWORDS ⭐

encoding, mime, quoted-printable, rfc 2045


Copyright (c) 1996-2003, Andreas Kupries <andreas_kupries@users.sourceforge.net>


and that's the whole page, bestie!! this was Trf transformer commands, version 2.1.3, and we're signing off from quoted-printable(3trf) πŸ’œβœ¨ go forth and encode responsibly, ily πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from