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

encoding/json: doc on valid key names is outdated #15317

Closed
glasser opened this issue Apr 15, 2016 · 6 comments
Closed

encoding/json: doc on valid key names is outdated #15317

glasser opened this issue Apr 15, 2016 · 6 comments

Comments

@glasser
Copy link
Contributor

@glasser glasser commented Apr 15, 2016

On master, the documentation for json.Marshal says:

// The key name will be used if it's a non-empty string consisting of
// only Unicode letters, digits, dollar signs, percent signs, hyphens,
// underscores and slashes.

However, this is quite outdated. The current list of allowed characters consists of letters, digits, space, and these punctuation characters: !#$%&()*+-./:<=>?@[]^_{|}~

I'm happy to send a Gerrit CL to fix this but am curious about what people think would be better: literally listing this set of characters, or saying something like "most punctuation characters, excluding backslash, quotes, and comma"?

@bradfitz bradfitz added this to the Go1.7 milestone Apr 15, 2016
@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Apr 15, 2016

What are you trying to link to? There is no line 7540 in that file?

@glasser

This comment has been minimized.

Copy link
Contributor Author

@glasser glasser commented Apr 15, 2016

Whoops, my fingers must have slipped and added an extra 0. Link fixed.

@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Apr 15, 2016

I see. Yeah, I don't think we want that soup of punctuation near English.

@glasser

This comment has been minimized.

Copy link
Contributor Author

@glasser glasser commented Apr 15, 2016

Something like:

Valid key names can contain Unicode letters, digits, spaces, and some punctuation marks (not including quotes, backslash, or comma). If the key name is not valid, the default name is used.

?

@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented May 27, 2016

This is the right text (fix the text, don't rewrite it):

// The key name will be used if it's a non-empty string consisting of
// only Unicode letters, digits, and ASCII punctuation except quotation
// marks, backslash, and comma.

@rsc rsc modified the milestones: Go1.7Maybe, Go1.7 May 27, 2016
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jun 2, 2016

CL https://golang.org/cl/23691 mentions this issue.

@gopherbot gopherbot closed this in 92cd6e3 Jun 3, 2016
@golang golang locked and limited conversation to collaborators Jun 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.