VIEW007: invalid-utf8
File is not valid UTF-8
| Code | VIEW007 |
| Name | invalid-utf8 |
| Category | View structure (VIEW) |
| Default severity | error |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports resource files (code.py, view.json, resource.json,
project.json, query.sql, ...) that are not valid UTF-8, at the first
invalid byte sequence; the others are labels of the same finding.
Why is this bad?
Section titled “Why is this bad?”Ignition reads project resources as UTF-8 and silently replaces every
invalid byte sequence with U+FFFD (�, the replacement character).
A file saved in another encoding, typically Latin-1 or Windows-1252 from an
external editor, therefore loads with its accented characters destroyed:
"caf\xe9" becomes "caf�" in a string, and an invalid byte in code
is a syntax error. A PEP 263 declaration such as # -*- coding: latin-1 -*- does not help: Ignition compiles scripts from text and rejects it
(SCR001).
iglint lints the rest of the file as Ignition sees it. Findings of other rules at an invalid sequence are not reported (they would be about the replacement character), and the file gets no automatic fixes, so its bytes are never rewritten.
Example
Section titled “Example”A library script saved as Latin-1 (the é is the single byte 0xE9):
LABEL = "Café"Use instead: the same script saved as UTF-8 (the é is 0xC3 0xA9).
Generated from the rule metadata by iglint generate-docs; iglint rule VIEW007 prints the same page in the terminal. Source: docs/rules/VIEW007.md.