Skip to content
EPUBCheck · Resources and references

EPUBCheck RSC-028: XML file not in UTF-8

Updated:

EPUBCheck RSC-028 is an error message: “XML documents must be encoded in UTF-8, but … was detected.” An XML file uses an encoding other than UTF-8, which EPUB requires for XML documents. Characters such as accents and quotes can show as garbage in reading apps.

The official message

XML documents must be encoded in UTF-8, but %1$s was detected.

Default severity
Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
EPUBCheck version
5.4.0

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • A file saved as ISO-8859-1, Windows-1252 or another legacy encoding, often declared in its XML declaration.
  • Text pasted from another document and saved with the editor's default encoding.

How to fix it

  1. Open the file named in the message in an editor that can change encodings.
  2. Convert the file to UTF-8 and change the XML declaration to encoding="UTF-8" (or remove the encoding attribute).
  3. Check accented characters after converting, then validate again.

When it's not this

UTF-16 is only a warning, RSC-027.

Terms used here

Other RSC messages

  • RSC-027 XML document is encoded in UTF-16. It should be encoded in UTF-8 instead.
  • RSC-029 Data URL is not allowed in this context.
  • RSC-026 URL "…" leaks outside the container (it is not a valid-relative-ocf-URL-with-fragment string)
  • RSC-030 File URLs are not allowed in EPUB, but found "…".
  • RSC-025 Informative parsing error: …
  • RSC-031 Remote resource references should use HTTPS, but found "…".

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck RSC-028 mean?

EPUBCheck RSC-028 is an error message: “XML documents must be encoded in UTF-8, but … was detected.” An XML file uses an encoding other than UTF-8, which EPUB requires for XML documents. Characters such as accents and quotes can show as garbage in reading apps.

Is RSC-028 an error?

RSC-028 is reported as error by default. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.

PDF to EPUB tools

Every tool uses the same engine and starts with a free 5-page sample.