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

Inconsistent quoting behavior when serializing strings starting with zero #701

Open
jefmathiot opened this issue Dec 20, 2024 · 1 comment

Comments

@jefmathiot
Copy link

Hello there,

we detected a weird behavior when serializing UUIDs. Some of them, such as 0054971b-b746-4776-ae7a-d942cd511393, are quoted during dump, whereas others, such as 0645cada-c729-48cb-a4e3-9d8cbc7cb510 aren't.

The observed behavior seems related to this commit created to fix this issue with floats handling.

The YAML 1.2 schema uses this regexp /[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?/ to match floats, but on Psych side this regexp is used: /\A0[0-7]*[89]/, which leads in my understanding to an inconsistent behavior.

I'd be glad to craft a PR but I' not sure whether Psych behavior is expected or not.

Thank you :)

@tenderlove
Copy link
Member

Hi,

Yes any patches are welcome. It seems like neither of these should be quoted. Perhaps the regular expression is missing an anchor? The second RE you quoted is for handling Octal numbers (not float).

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

No branches or pull requests

2 participants