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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected unicode escaping #227

Open
alessio-b2c2 opened this issue Feb 15, 2023 · 3 comments
Open

Unexpected unicode escaping #227

alessio-b2c2 opened this issue Feb 15, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alessio-b2c2
Copy link

Description

When using this configuration, unicode characters are printed using the escape sequence, rather than the unicode characters itself:

quote_basic_values=true
quote_representation='"'

Steps to reproduce

Run:

echo "a: 馃搱" | YAMLFIX_quote_basic_values=true YAMLFIX_quote_representation='"' yamlfix -  2>/dev/null

Current behavior

---
a: "\U0001F4C8"

Desired behavior

---
a: "馃搱"

Environment

python -c "import yamlfix.version; print(yamlfix.version.version_info())"
------------------------------------------------------------------
     yamlfix: 1.8.1
     Python: 3.10.9
     Platform: macOS-13.2-x86_64-i386-64bit
------------------------------------------------------------------
@alessio-b2c2 alessio-b2c2 added the bug Something isn't working label Feb 15, 2023
@lyz-code
Copy link
Owner

lyz-code commented Feb 16, 2023

Interesting bug, thanks for reporting it @alessio-b2c2 . As a side note, the next executions don't trigger the bug, only the combination of those two configuration options:

echo "a: 馃搱" | YAMLFIX_quote_representation='"' yamlfix -  2>/dev/null 
echo "a: 馃搱" | YAMLFIX_quote_basic_values=true  yamlfix -  2>/dev/null 
echo "a: 馃搱" | yamlfix -  2>/dev/null 

I'm afraid I won't have time to fix this bug in the short future, will you be able to make a pull request to fix it?

@lyz-code lyz-code added help wanted Extra attention is needed good first issue Good for newcomers labels Feb 16, 2023
@alessio-b2c2
Copy link
Author

Is it possible the bug is in the ruyaml lib itself?

@lyz-code
Copy link
Owner

Maybe, but I don't think so because only one combination of yamlfix configuration parameters does raise the bug and we use ruyaml on all the cases. I don't remember very well the involved code so don't take my word very serious :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants