Skip to content

fix: the TOML reader refuses the \u, \U, \b and \f escapes of a basic string #865

Closed

Description

@NopeCharon

Reproduction

[package]
name        = "hello"
version     = "0.1.0"
description = "café"
$ mcpp build
error: /path/to/hello/mcpp.toml:4:20: error: invalid escape '\u'

The same happens for \U0001F600, \b and \f. All four are valid escapes in a TOML 1.0 basic string, and so the manifest above is valid TOML.

mcpp.libs.toml (modules/libs/src/toml.cppm) accepts only \n, \t, \r, \", \\ and \0. The same switch is duplicated in read_string and read_multiline_string, so both single-line and multi-line basic strings and quoted keys refuse these escapes. The parser reads mcpp.toml, mcpp.lock, the configuration files and template metadata, so any of them written with a Unicode escape (often by a tool that ASCII-escapes non-ASCII text) cannot be loaded.

Expected

The parser reads every escape TOML 1.0 defines: \b, \t, \n, \f, \r, \", \\, \uXXXX and \UXXXXXXXX. A Unicode escape gives UTF-8 bytes. An escape that does not name a Unicode scalar value (a surrogate, a value above U+10FFFF, or too few hex digits) is refused with a message that names it.

Actual

invalid escape '\u' (or '\U', '\b', '\f') and the file is not read.

Environment

  • mcpp version: 2026.10.29.1 (main at db3b815)
  • OS: any; the parser is host-independent

Activity

  1. added a commit that references this issue on Oct 31, 2026
    9c65437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions