-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Package strconv says:
Unquote interprets s as a single-quoted, double-quoted, or backquoted Go string literal, returning the string value that s quotes.
I understand "backquoted Go string literal" to mean what the Go spec calls a "raw string literal". Also, according to the Go spec:
Carriage return characters ('\r') inside raw string literals are discarded from the raw string value.
However, it seems that strconv.Unquote keeps carriage return characters rather than discarding them: https://play.golang.org/p/G-4x0-Mdop (Note that the \r escape sequence is interpreted by the Go interpreted string literal, so the string value seen by strconv.Unquote is the three byte sequence: GRAVE ACCENT, CARRIAGE RETURN, GRAVE ACCENT.)
It may be too late to change strconv.Unquote's behavior, but perhaps the existing behavior can be better documented at least.