Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emoji_support contains bad content where there is a literal string #62

Closed
longkai opened this issue Oct 18, 2022 · 3 comments
Closed

emoji_support contains bad content where there is a literal string #62

longkai opened this issue Oct 18, 2022 · 3 comments

Comments

@longkai
Copy link
Contributor

longkai commented Oct 18, 2022

So when you set emoji_support to true, adding a test case to the unicode_test.go:

		{
			name: "literal string",
			yamlStr: `a: |
  hello 😄\n`,
			expectedStr: `a: |
  hello 😄\n`,
		},

Which results:

parsed string does not match:
        expected: a: |
          hello 😄\n
        got: a: "hello 😄n"

I suppose the literal string turns one line due to the go-yaml library. However, the tail n is unacceptable.

@longkai longkai changed the title emoji_support contains bug where there is a literal string emoji_support contains a content bug where there is a literal string Oct 18, 2022
@longkai longkai changed the title emoji_support contains a content bug where there is a literal string emoji_support contains bad content where there is a literal string Oct 18, 2022
@longkai longkai closed this as completed Oct 18, 2022
@longkai
Copy link
Contributor Author

longkai commented Oct 18, 2022

Sorry, I should not use \n in literal string qaq

@braydonk
Copy link
Collaborator

I notice you've closed it now, but here's what I've got about the issues with the output just to keep track.

Of the 3 issues with the output:

  • Double quotes around the result
    • This is from the yaml library. I haven't yet thought of a context free way to get rid of these due to the way they are added into the formatted output, but I'm experimenting with solutions.
  • Outputting to a single line
    • This is also from the library, and this one I'm not sure why it does that. It's possible the yaml.Node serialization doesn't retain the | multiline literal syntax information.
  • The trailing n

@longkai
Copy link
Contributor Author

longkai commented Oct 18, 2022

Haha I also found the issue and it should advance one byte to check 'U'.

Besides I figure it out why it always formats to a single line since it considers emoji is not printable, so the text contains special characters and always output to escaped one line instead of multi-line literal string or simple string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants