Home / Docs / Diagnostics
U0005: Invalid escape sequence
Release v0.4.0
U0005 reports a backslash in a text literal that does not start a valid escape sequence.
Why Una rejects it
Inside a text literal, a backslash starts an escape sequence. The valid escapes are \", \\, \n, \t, \{, \} and \u{H}, where H is one to six hexadecimal digits naming a Unicode scalar value (spec/01 §6).
U0005 reports:
- any other character after a backslash,
- a
\uescape without braces or digits, - a code point that is a surrogate or above
10FFFF.
How to fix it
Write a backslash itself as \\.
The repair at a glance
diff
module demo
- pub folder() -> Text = "C:\data"
+ pub folder() -> Text = "C:\\data"Failing example
una
module demo
pub folder() -> Text = "C:\data"Fixed example
una
module demo
pub folder() -> Text = "C:\\data"