xml2asc(1)

xml2asc1

Convert utf-8 to &#nnn; entities

Usage

xml2asc

Overview

Reads an UTF-8 encoded text from standard input and writes to standard output, converting all non-ASCII characters to &#nnn; entities, so that the result is ASCII-encoded.

One example use is to convert ISO-8859-1 to ASCII with &#nnn; entities, by first running asc2xml to convert ISO-8859-1 to UTF-8 and then pipe the result into xml2asc to convert to ASCII with &#nnn; entities for all accented characters.

To test if a file is correct UTF-8, ignore the output and test the exit code, e.g. in Bash:

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

Diagnostics

xml2asc returns with a non-zero exit code if the input was not UTF-8.

Releases

9 releases since Debian 6.0 (Squeeze); the text changed 3 times.

  1. 6.0
  2. 7
  3. 8
  4. 9–Arch

Bugs

Doesn't 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.

From html-xml-utils 8.8-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.