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

strconv: Quote method that uses IsGraphic not IsPrint #11511

Closed
robpike opened this issue Jul 2, 2015 · 4 comments
Closed

strconv: Quote method that uses IsGraphic not IsPrint #11511

robpike opened this issue Jul 2, 2015 · 4 comments

Comments

@robpike
Copy link
Contributor

robpike commented Jul 2, 2015

The IsPrint method is of our own design and makes sense, but it means that ideographic languages using for instance U+3000, the ideographic space, quote badly.

There should be a variant, perhaps strconv.QuoteGraphic, that offers the distinction, or perhaps a more general method that allows a func to make the definition.

@robpike
Copy link
Contributor Author

robpike commented Aug 26, 2015

Is %+q available for doing this from fmt?

@robpike robpike modified the milestones: Go1.6Early, Go1.6 Aug 26, 2015
@rsc
Copy link
Contributor

rsc commented Aug 26, 2015

Should probably be QuoteToGraphic like existing QuoteToASCII.

@gopherbot
Copy link

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

robpike added a commit that referenced this issue Sep 8, 2015
This version of quoting allows runes in category Zs, such as the
ideographic space characters, to be passed through unquoted.

Still to do (maybe): A way to access this from Printf.

Updates #11511.

Change-Id: I3bae84b1aa0bc1b885318d3f67c5f451099a2a5a
Reviewed-on: https://go-review.googlesource.com/14184
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
@robpike
Copy link
Contributor Author

robpike commented Sep 8, 2015

There are no suitable flags available in Printf's %q verb, so without something awful and unprecedented like a double flag %#+q, this is the best we can do.

@robpike robpike closed this as completed Sep 8, 2015
@golang golang locked and limited conversation to collaborators Sep 8, 2016
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants