Skip to content
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

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.

Activity

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