Skip to content
EPUBCheck · Resources and references

EPUBCheck RSC-027: XML file encoded in UTF-16

Updated:

EPUBCheck RSC-027 is a warning message: “XML document is encoded in UTF-16. It should be encoded in UTF-8 instead.” An XML file is encoded in UTF-16; EPUB recommends UTF-8 for every XML document. It is a warning: the file is still read, but some reading apps handle UTF-16 poorly.

The official message

XML document is encoded in UTF-16. It should be encoded in UTF-8 instead.

Default severity
Warning. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.
EPUBCheck version
5.4.0

Typical causes

  • A file saved in UTF-16 by an editor, common with some Windows tools that call it "Unicode".
  • Files exported by an older word processor or script with UTF-16 as the default.

How to fix it

  1. Open the file named in the message in an editor that can change encodings.
  2. Re-save it as UTF-8 and make its XML declaration say encoding="UTF-8".
  3. Validate again.

When it's not this

Any other non-UTF-8 encoding (ISO-8859-1, Windows-1252) is the error RSC-028.

Terms used here

Other RSC messages

  • RSC-026 URL "…" leaks outside the container (it is not a valid-relative-ocf-URL-with-fragment string)
  • RSC-028 XML documents must be encoded in UTF-8, but … was detected.
  • RSC-025 Informative parsing error: …
  • RSC-029 Data URL is not allowed in this context.
  • RSC-024 Informative parsing warning: …
  • RSC-030 File URLs are not allowed in EPUB, but found "…".

Sources

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

FAQ

What does EPUBCheck RSC-027 mean?

EPUBCheck RSC-027 is a warning message: “XML document is encoded in UTF-16. It should be encoded in UTF-8 instead.” An XML file is encoded in UTF-16; EPUB recommends UTF-8 for every XML document. It is a warning: the file is still read, but some reading apps handle UTF-16 poorly.

Is RSC-027 an error?

RSC-027 is reported as warning by default. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.