-
Notifications
You must be signed in to change notification settings - Fork 18k
strings: Map produces invalid utf-8 when passed PAD (U+0080) #25242
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
Comments
Change https://golang.org/cl/111286 mentions this issue: |
There may well be a bug here (and I believe you've diagnosed it) but this is the first time I've heard U+0080 called PAD. Where did you get that name? |
The word http://www.unicode-symbol.com/u/0080.html But a document from unicode.org does not mention "PAD" or "PADDING CHARACTER" anywhere. It also does not render the glyph in a way that suggests "PAD" is an identifier for it. http://www.unicode.org/charts/PDF/U0080.pdf ISO 7816-4 described |
Best I can tell the name If you think the name (or lack thereof) is a problem, let's appreciate that we aren't tasked with deciphering what the character means. The answer to that starts with |
@gopherbot Please consider this for backport to 1.10, it's a regression. |
Backport issue(s) opened: #25479 (for 1.10). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
@gopherbot please backport to 1.9 as well |
What version of Go are you using (
go version
)?go version go1.10.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOOS="darwin"
GOARCH="amd64"
What did you do?
Calling
strings.ToLower
with a PAD (U+0080) character causes the output to be invalid utf-8. It appears this bug is a faulty boundary condition instrings.Map
: the comparisonsr <= utf8.RuneSelf
should perhaps be rewritten asr < utf8.RuneSelf
.https://play.golang.org/p/YVkdm_KyRPT
What did you expect to see?
0x41c280
true
0x61c280
true
What did you see instead?
0x41c280
true
0x6180
false
The text was updated successfully, but these errors were encountered: