Home / Docs / Diagnostics

U0001: Invalid character, byte order mark or lone carriage return

Release v0.4.0

U0001 reports a character that cannot appear where it is, a byte sequence that is not valid UTF-8, a byte order mark at the start of the file, and a carriage return not followed by a line feed. Lexing continues after the error, so later problems in the file are still reported.

Why Una rejects it

Every source file is UTF-8 text without a byte order mark, and its lines end with \n or \r\n.

How to fix it

Write control characters and Unicode bidirectional controls in text with \u{...} escapes.

The repair at a glance

diff
  module demo

- pub café() -> Text = "coffee"
+ pub cafe() -> Text = "coffee"

Failing example

una
module demo

pub café() -> Text = "coffee"

Fixed example

una
module demo

pub cafe() -> Text = "coffee"