mojira.dev
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 /

[media]

*/ 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]

Linked issues

Comments 0

No comments.

intsuc

(Unassigned)

Confirmed

Commands

nbt

1.15.2, 20w08a, 20w09a, 20w10a, 20w11a, ..., 24w04a, 1.21.1, 24w33a, 1.21.4, 25w04a

Retrieved