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

Don't escape unicode fields in YAML Documents #2420

Open
fearful-symmetry opened this issue Jan 8, 2025 · 0 comments
Open

Don't escape unicode fields in YAML Documents #2420

fearful-symmetry opened this issue Jan 8, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@fearful-symmetry
Copy link
Contributor

fearful-symmetry commented Jan 8, 2025

This is a continuation of an issue in endpoint; right now the default behavior of yaml.dump() in scripts/generators/ecs_helpers.py is to escape unicode characters, but this behavior appears to be platform dependent, meaning that the copyright character will get escaped one of two ways:

example: "Microsoft\xAE Windows\xAE Operating System" # this is the unicode codepoint

or:

 example: "Microsoft\xC2\xAE Windows\xC2\xAE Operating System" # this is the UTF-8 value

This results in massive, needless diffs after running the update scripts, depending on who is running them at any given time.
I'm not sure if there's a reason why we're escaping unicode here, I assume it's just because it's the default behavior.

If we change it to this:

        yaml.dump(data, outfile, default_flow_style=False, allow_unicode=True)

We'll get this:

      example: Microsoft® Windows® Operating System

Which solves the problem.

@fearful-symmetry fearful-symmetry added the bug Something isn't working label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant