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

Keys with symbols aren't quoted but they should be #30

Closed
ThatCoolCoder opened this issue Jun 26, 2023 · 1 comment · Fixed by #33
Closed

Keys with symbols aren't quoted but they should be #30

ThatCoolCoder opened this issue Jun 26, 2023 · 1 comment · Fixed by #33

Comments

@ThatCoolCoder
Copy link

I have a dictionary like so:

var obj = new Dictionary<string, string>()
{
    {"normal-key", "value for normal key"},
    {"key with spaces", "value for key with spaces"},
    {"key!with{}(*%&)random[other+symbols", "value for key with random other symbols"},
    {"key/with/slashes", "value for key with slashes"},
};

And I'm saving it with TomletMain.TomlStringFrom(obj);, but some of the keys in the output are not quoted even though they should be:

normal-key = "value for normal key" # correctly not quoted
"key with spaces" = "value for key with spaces" # correctly quoted
key!with{}(*%&)random[other+symbols = "value for key with random other symbols" # should be quoted but isn't
key/with/slashes = "value for key with slashes" # should be quoted but isn't

Now this isn't actually causing a problem for me currently since the only non-alphanumeric characters in my keys are forward slashes (which Tomlet can read back just fine), but technically this is against the toml spec and would cause issues with other characters.

Also, I get a Tomlet.Exceptions.TomlNoSuchValueException if I try having dictionary keys with full stops in them, but I don't know if that's a problem with this library or if that's against the toml spec.

@SamboyCoding
Copy link
Owner

The dictionary keys with full stops thing actually is a confusing-enough point that there's a paragraph or so on it https://github.com/SamboyCoding/Tomlet#a-word-on-dotted-keys

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