Skip to content

strings: Map produces invalid utf-8 when passed PAD (U+0080) #25242

@petercgrant

Description

@petercgrant

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 in strings.Map: the comparisons r <= utf8.RuneSelf should perhaps be rewritten as r < 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions