Skip to content
EPUBCheck · Stylesheets

EPUBCheck CSS-003: CSS file saved as UTF-16

Updated:

EPUBCheck CSS-003 is a warning message: “CSS document is encoded in UTF-16. It should be encoded in UTF-8 instead.” A CSS file is encoded in UTF-16, and UTF-8 is recommended. EPUB 3.3 allows UTF-8 or UTF-16 for stylesheets, so this is only a warning, but UTF-8 is the encoding every reading app handles.

The official message

CSS 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 stylesheet saved in UTF-16 by an editor, often labelled "Unicode" in save dialogs.
  • A @charset rule naming UTF-16 left from another project.

How to fix it

  1. Open the file EPUBCheck names (the message gives the path, line and column) in a text or EPUB editor such as Sigil, or unzip the EPUB and open it there.
  2. Re-save the file as UTF-8.
  3. Change any @charset rule at the top to @charset "UTF-8"; or remove it.
  4. Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.

When it's not this

If the file is in an encoding that is neither UTF-8 nor UTF-16, the error is CSS-004.

Terms used here

Other CSS messages

  • CSS-002 Empty or NULL reference found.
  • CSS-004 CSS documents must be encoded in UTF-8, detected …;
  • CSS-001 The "…" property must not be included in an EPUB Style Sheet.
  • CSS-005 Conflicting alternate style tags found: ….
  • CSS-006 CSS selector specifies fixed position.
  • CSS-007 Font-face reference "…" refers to non-standard font type "…".

Sources

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

FAQ

What does EPUBCheck CSS-003 mean?

EPUBCheck CSS-003 is a warning message: “CSS document is encoded in UTF-16. It should be encoded in UTF-8 instead.” A CSS file is encoded in UTF-16, and UTF-8 is recommended. EPUB 3.3 allows UTF-8 or UTF-16 for stylesheets, so this is only a warning, but UTF-8 is the encoding every reading app handles.

Is CSS-003 an error?

CSS-003 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.