mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
URL-encode according to RFC 3986
This commit is contained in:
@ -27,13 +27,15 @@ func Decode(str string) (string, error) {
|
||||
return url.QueryUnescape(str)
|
||||
}
|
||||
|
||||
// RawEncode .URL-encode according to RFC 3986.
|
||||
// RawEncode Encodes the given string according
|
||||
// URL-encode according to RFC 3986.
|
||||
// See http://php.net/manual/en/function.rawurlencode.php.
|
||||
func RawEncode(str string) string {
|
||||
return strings.Replace(url.QueryEscape(str), "+", "%20", -1)
|
||||
}
|
||||
|
||||
// RawDecode Decode URL-encoded strings.
|
||||
// RawDecode does decode
|
||||
// Decode URL-encoded strings.
|
||||
// See http://php.net/manual/en/function.rawurldecode.php.
|
||||
func RawDecode(str string) (string, error) {
|
||||
return url.QueryUnescape(strings.Replace(str, "%20", "+", -1))
|
||||
|
||||
Reference in New Issue
Block a user