]> Cypherpunks repositories - gostls13.git/commitdiff
net/url: clarify QueryUnescape and PathUnescape doc
authorAlberto Donizetti <alb.donizetti@gmail.com>
Fri, 10 Nov 2017 19:35:45 +0000 (20:35 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 14 Nov 2017 16:33:08 +0000 (16:33 +0000)
In the doc for QueryUnescape and PathUnescape, clarify that by 0xAB we
means a substring with any two valid hexadecimal digits.

Fixes #18642

Change-Id: Ib65b130995ae5fcf07e25ee0fcc41fad520c5662
Reviewed-on: https://go-review.googlesource.com/77050
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/url/url.go

index 509cec3ba0a33c998ce8ab618fbfd7cec04b6469..92c9c27d705b9aec05661454d06ddbb3b72fe6c3 100644 (file)
@@ -163,18 +163,23 @@ func shouldEscape(c byte, mode encoding) bool {
        return true
 }
 
-// QueryUnescape does the inverse transformation of QueryEscape, converting
-// %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if
-// any % is not followed by two hexadecimal digits.
+// QueryUnescape does the inverse transformation of QueryEscape,
+// converting 3-byte encoded substrings of the form "%AB" into the
+// hex-decoded byte 0xAB. It also converts '+' into ' ' (space).
+// It returns an error if any % is not followed by two hexadecimal
+// digits.
 func QueryUnescape(s string) (string, error) {
        return unescape(s, encodeQueryComponent)
 }
 
-// PathUnescape does the inverse transformation of PathEscape, converting
-// %AB into the byte 0xAB. It returns an error if any % is not followed by
-// two hexadecimal digits.
+// PathUnescape does the inverse transformation of PathEscape,
+// converting 3-byte encoded substrings of the form "%AB" into the
+// hex-decoded byte 0xAB. It also converts '+' into ' ' (space).
+// It returns an error if any % is not followed by two hexadecimal
+// digits.
 //
-// PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).
+// PathUnescape is identical to QueryUnescape except that it does not
+// unescape '+' to ' ' (space).
 func PathUnescape(s string) (string, error) {
        return unescape(s, encodePathSegment)
 }