GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

✨ GOLF(2gg) ✨

okay bestie, so this is a page from the GOLF manual β€” that's the Development section, iykyk πŸ’… β€” and today's main character is encode-web, which lives in the (web-encoding) family. let's get into it πŸŽ€


🌸 NAME 🌸

encode-web β€” the web-encoding one (web-encoding)

πŸ¦‹ PURPOSE πŸ¦‹

web (HTML)-encode a string. that's it. that's the whole job. she's simple, she's iconic πŸ’–

✨ SYNTAX ✨

encode-web <string> to <encoded string> \
    [ input-length <length> ]

πŸ’… DESCRIPTION πŸ’…

so encode-web takes <string> and encodes it so it's safe to drop into HTML-ish markup text β€” think a web page, or an XML/XHTML document β€” and then it stashes the glow-up in <encoded string>. no cap ✨

and listen, if you only wanna encode the first bit? you can. just pass the input-length clause with <length>, and only the first <length> bytes get encoded. short king energy, but make it encoding 🌈

πŸ“ EXAMPLES πŸ“

ok so here's the vibe: we've got a string in the variable str, we web-encode it, and the result lands in result 🫢

set-string str="  x<y>z&\"'  "
encode-web str to result

and result comes out as:

   x&lt;y&gt;z&amp;&quot;&apos;

see how every little spicy character got tamed?? &lt;, &gt;, &amp;, &quot;, &apos; β€” she ate and left no crumbs πŸ‘‘πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

  • Web encoding
  • decode-web
  • encode-web
  • See all documentation

ok that's the whole page bestie, ty for coming to my ted talk πŸ§šπŸ’œ

this page is version $VERSION, dated $DATE, and yes it's still GOLF(2gg) at the bottom β€” slay πŸ’…

πŸ“¦ where this page comes from