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

regexp: QuoteMeta does not return regexp that matches input #11173

Closed
dvyukov opened this issue Jun 11, 2015 · 1 comment
Closed

regexp: QuoteMeta does not return regexp that matches input #11173

dvyukov opened this issue Jun 11, 2015 · 1 comment

Comments

@dvyukov
Copy link
Member

@dvyukov dvyukov commented Jun 11, 2015

The following program crashes with the panic:

package main

import "regexp"

func main() {
    regexp.MustCompile(regexp.QuoteMeta("\xfe"))
}
panic: regexp: Compile("\xfe"): error parsing regexp: invalid UTF-8: `�`

Documentation claims that "the returned string is a regular expression matching the literal text".

go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 11, 2015

Package regexp only works on UTF-8. The package docs say "All characters are UTF-8-encoded code points."

@bradfitz bradfitz closed this Jun 11, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
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
3 participants
You can’t perform that action at this time.