Aha...
This Python doc footnote, though it applies to a different situation, alerted me to the fact that my XML encoding declaration was wrong:
The encoding string included in XML output should conform to the appropriate standards. For example, “UTF-8” is valid, but “UTF8” is not.
For some reason I was under the impression that utf8
was acceptable too. But when I changed the declaration to
<?xml version="1.0" encoding="utf-8"?>
the error went away!