Skip to content

strconv: Quote produces string that is not accepted by the compiler #3927

@rogpeppe

Description

@rogpeppe
fmt.Printf("%q", []byte{0xed, 0xa3, 0xbe})

prints
"\ud8fe"

This string literal is rejected by the Go compiler with the error
"invalid Unicode code point in escape sequence"

The fix I think, as suggested by rob on the mailing list,
is to reject surrogate characters in utf8.DecodeRuneInString.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions