Mojira Archive
MC-173120

Lack of escape sequences of newlines prevents quoted strings from containing newlines in a function

The bug

Though quoted strings in commands do not allow escape sequences except for backslash, \"(for double-quoted strings) and \'(for single-quoted strings), they can still contain control characters by embedding them directly and can represent any string in a command block.

However, this does not hold in a function since line feed (U+000A) and carriage return (U+000D) work as a command separator. Valid contents of quoted strings vary with the context: /.*/ in a command block and /[^\n\r]*/ in a function, in regex.

This inconsistency will be resolved by adding escape sequences of newlines.

Affected commands

  • /datapack enable "\n"

    Invalid escape sequence '\n' in quoted string ... enable "\n"<--[HERE]

  • /data modify storage _ _ set value "\r"

     Invalid escape sequence '\r' in quoted string ...t value "\r"<--[HERE]