Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Allow unicode escape sequences of emojis in quoted strings #128

@hpoul

Description

@hpoul

It should be allowed to add arbitrary escape sequences in quoted strings like:

example: "emoji \uD83D\uDE05"

the weird thing is that emojis in quoted strings work, but only if they are not escaped:

testYaml(r'''test: "Lorem ipsum 😅"''');
testYaml(r'''test: "Lorem ipsum \uD83D\uDE05"''');
void main(List<String> arguments) {
  testYaml(r'''test: "Lorem ipsum  😅"''');
  testYaml(r'''test: "Lorem ipsum   \uD83D\uDE05"''');
}

void testYaml(String yamlSource) {
  try {
    final result = loadYaml(yamlSource);
    print('loaded: $result');
  } catch (e) {
    print('error while loading: $e');
  }
}
loaded: {test: Lorem ipsum  😅}
error while loading: Error on line 1, column 22: Invalid Unicode character escape code.
  ╷
1 │ test: "Lorem ipsum   \uD83D\uDE05"
  │                      ^^^^^^
  ╵

I haven't found anything in the yaml spec which would limit the character set allowed as escaped characters.

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