Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Decoding quoted keys with new lines #185

Closed
alanhdu opened this issue Jun 1, 2017 · 1 comment
Closed

Decoding quoted keys with new lines #185

alanhdu opened this issue Jun 1, 2017 · 1 comment

Comments

@alanhdu
Copy link
Contributor

alanhdu commented Jun 1, 2017

TOML will happily deserialize

"\n" = 5

but if you try and serialize it, it will return toml::ser::Error::KeyNewLine.

So AFAICT, this behavior is motivated by the key-newline.toml test, so this might be expected behavior. But for consistency, I feel like either TOML should refuse to deserialize "\n" as a key, or to go ahead and serialize it as a quoted string key.

Found with https://github.com/rust-fuzz/targets

@alexcrichton
Copy link
Collaborator

Aha nice find! I think we should have a special mode of serializing strings here, falling back to this style of escaped newlines for string keys (to make this round-trippable)

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

No branches or pull requests

2 participants