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: CanBackquote doesn't work with 0x7f and above #7565

Closed
bradfitz opened this issue Mar 17, 2014 · 3 comments
Closed

strconv: CanBackquote doesn't work with 0x7f and above #7565

bradfitz opened this issue Mar 17, 2014 · 3 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

strconv.CanBackquote doesn't seem to work as advertised.

Noticed via https://golang.org/cl/76730043/

Doesn't handle bad UTF-8 either: http://play.golang.org/p/zLTuou_Tha

Fix, or document?
@rui314
Copy link
Member

rui314 commented Mar 17, 2014

Comment 1:

It doesn't also take into account Unicode C1 control characters. Not sure it's intended
or not.

@robpike
Copy link
Contributor

robpike commented Mar 18, 2014

Comment 2:

// CanBackquote reports whether the string s can be represented
// unchanged as a single-line backquoted string without control
// characters other than space and tab.
Since U+007F is a control character, the function should protect against them. That is a
bug.
Regarding bad UTF-8, it's much less clear. Badly encoded UTF-8 is not a "control
character". On the other hand, if the UTF-8 is bad, the string cannot be "represented
unchanged" in some sense.
I will address the 7F issue and open a new issue for bad UTF-8, which is a larger topic
less clear cut. See issue #7572.

@robpike
Copy link
Contributor

robpike commented Mar 18, 2014

Comment 3:

This issue was closed by revision f34251a.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
This issue was closed.
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

5 participants