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 πππ¦πΈππ§
π¦ where this page comes from
- alpine 3.24: html-xml-utils-doc 8.7-r0 Β· W3C
- arch rolling: html-xml-utils 8.8-1 Β· W3C
- debian bookworm: html-xml-utils 7.7-1.1 Β· W3C
- debian trixie: html-xml-utils 7.7-1.1+b1 Β· W3C
- fedora 43: html-xml-utils 8.6-2.fc41 Β· W3C AND BSD-3-Clause
- fedora 44: html-xml-utils 8.7-1.fc44 Β· W3C AND BSD-3-Clause
- nixos 26.05: html-xml-utils 8.7
- nixpkgs unstable: html-xml-utils 8.7
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- ubuntu jammy: html-xml-utils 7.7-1.1 Β· W3C
- ubuntu noble: html-xml-utils 7.7-1.1build2 Β· W3C
- ubuntu questing: html-xml-utils 7.7-1.1build2
- ubuntu resolute: html-xml-utils 7.7-1.3 Β· W3C
- ubuntu stonking: html-xml-utils 7.7-1.3 Β· W3C
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms