# EPUBCheck CSS-004: CSS file not in UTF-8, how to fix it

Source: https://epubcc.com/epubcheck/css-004/ (updated 2026-11-04)

EPUBCheck CSS-004 is an error message: “CSS documents must be encoded in UTF-8, detected …;.” A CSS file uses an encoding other than UTF-8 or UTF-16, which EPUB does not allow. Accented letters and symbols in content: strings or font names can then display wrongly; EPUBCheck names the encoding it detected.

- Official message (EPUBCheck 5.4.0): CSS documents must be encoded in UTF-8, detected %1$s;
- Default severity: Error

## Typical causes

- A stylesheet saved as ISO-8859-1 or Windows-1252.
- A @charset rule at the top of the file naming another encoding.

## 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. Convert the file to UTF-8 in your editor or with a tool such as iconv.
3. Change the @charset rule 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 UTF-16, that is only the warning CSS-003.

## Sources

- EPUB 3.3, §6.3.1.2 CSS requirements: https://www.w3.org/TR/epub-33/#sec-css-req (read 2026-11-04)

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