XML2ASC(1)

✨ NAME ✨

xml2asc β€” bestie, she takes your UTF-8 and turns it into &#nnn; entities πŸ’–


🌸 SYNOPSIS 🌸

xml2asc

That's it. No flags, no options, no drama. She just vibes on standard input πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

okay so here's the tea β˜• xml2asc reads a UTF-8 encoded text from standard input and writes it right back out to standard output β€” but here's the glow-up: every single non-ASCII character gets converted into a &#nnn; entity, so what comes out the other side is fully ASCII-encoded. iconic behaviour honestly πŸ‘‘

Like, one example use is converting ISO-8859-1 to ASCII with &#nnn; entities, and the way you do that is a two-step bestie pipeline: first run asc2xml to turn that ISO-8859-1 into UTF-8, then pipe the result into xml2asc to convert it to ASCII with &#nnn; entities for all the accented characters. slay πŸ’…

Also!! wanna test if a file is correct UTF-8? 🧐 Just ignore the output entirely and test the exit code instead. Like, in Bash:

xml2asc <myfile >/dev/null && echo "OK" || echo "Fail"

not me using the exit code as the main character 😭✨


πŸ” DIAGNOSTICS πŸ”

xml2asc returns with a non-zero exit code if the input was not UTF-8. that's your vibe check failing fr fr πŸ’€


🫢 SEE ALSO 🫢

  • asc2xml(1) β€” the other half of the pipeline, her partner in crime πŸ’œ
  • UTF-8 (RFC 2279) β€” the lore, the origin story πŸ“œ

πŸ™ˆ BUGS πŸ™ˆ

ngl she does not distinguish mark-up from content 😬 so if the input uses non-ASCII characters in XML element names, they will be output with numerical entities in them β€” which is not legal in XML. so like, don't do that. periodt 🚫


⭐ and that's the whole page bestie ⭐ this is from the HTML-XML-utils fam, version 7.x, dated 10 Jul 2011 β€” yeah she's vintage but she still eats πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ“πŸ§š