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

fix: escape escape codes in the serializer #22

Merged
merged 1 commit into from
Sep 28, 2024
Merged

Conversation

0x5a4
Copy link
Contributor

@0x5a4 0x5a4 commented Sep 28, 2024

fixes #21

I've also noticed another issue which I fixed alongside this. Previously, when given a string like hello\n we would happily write this to the output stream:

key = "hello
"

which is of course very wrong.

@0x5a4
Copy link
Contributor Author

0x5a4 commented Sep 28, 2024

hmmm, how should we handle non ascii chars? should we just write them as is (the current behaviour)? or maybe convert them to the appropriate toml escape code \uXXXX

Copy link
Owner

@mattyhall mattyhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, how should we handle non ascii chars?

The docs say:

Any Unicode character may be used except those that must be escaped: quotation mark, backslash, and the control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F).

So I think we can leave them as is, apart from the control characters which we do need to escape.

src/serializer.zig Show resolved Hide resolved
src/serializer.zig Outdated Show resolved Hide resolved
src/serializer.zig Show resolved Hide resolved
Copy link
Owner

@mattyhall mattyhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattyhall mattyhall merged commit bb7706f into mattyhall:main Sep 28, 2024
1 check failed
@0x5a4
Copy link
Contributor Author

0x5a4 commented Sep 28, 2024

could you merge #17 as well?

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

Successfully merging this pull request may close these issues.

Serializing paths on windows doesn't escape backslash
2 participants