# module_encoding

> A module is not UTF-8 or starts with a byte-order mark.

A module is not UTF-8 or starts with a byte-order mark.

| | |
| --- | --- |
| Kind | Build or validation problem |
| Reported by | Archive and source validation |
| `disko` exit code | 1 (problems) |

A module's bytes are not valid UTF-8, or the file starts with a UTF-8
byte-order mark (BOM). Modules must be plain UTF-8 text with no BOM.

## Why it happens

Some editors on Windows save files as UTF-16, as a legacy code page (such as
Windows-1252), or as "UTF-8 with BOM". Non-ASCII characters in strings or
comments then turn into invalid bytes.

## Wrong

```text
src/main.js   saved as "UTF-8 with BOM" (starts with EF BB BF)
```

## Right

```text
src/main.js   saved as "UTF-8" (no BOM)
```

Re-save the file as UTF-8 without a BOM; most editors show the encoding in the
status bar.

## See also

- [Project structure & imports](/games/project-structure)
- [`module_syntax`](/errors/module_syntax)
