Skip to content
Playground(another site)

bynk.lex.bad_unicode_escape

Error A \u{…} escape names a surrogate or a value above U+10FFFF.

A \u{…} escape must name a Unicode scalar value, so a string is always valid text. A surrogate (D800 to DFFF) is half of a UTF-16 pair and stands for no character on its own, and anything above 10FFFF is outside Unicode. Write the code point of the character you mean, such as \u{E9} for é. A \u with no braces, no digits or more than six digits is bynk.lex.bad_escape.

Example

const Mark: String = "\u{D800}" // ✗ a surrogate is not a character
const Mark: String = "\u{E9}" // ✓ `é`

In the Book

See also

  • The grammar rule it governs: string_literal.
  • Every code in its category, Lexer, on the diagnostic index.
  • bynk explain bynk.lex.bad_unicode_escape shows the same from the installed toolchain, without a network.