Browse Source

add decodeURIComponent

tags/v0.7.11^2
jojoliang 5 years ago
parent
commit
f6c91c92d6
  1. 17
      helper.go

17
helper.go

@ -6,6 +6,7 @@ import (
"crypto/sha1"
"fmt"
"net/http"
"net/url"
)
// 计算 md5 或 sha1 时的分块大小
@ -83,3 +84,19 @@ func encodeURIComponent(s string) string {
b.WriteString(s[written:])
return b.String()
}
func decodeURIComponent(s string) (string, error) {
decodeStr, err := url.QueryUnescape(s)
if err != nil {
return s, err
}
return decodeStr, err
}
func DecodeURIComponent(s string) (string, error) {
return DecodeURIComponent(s)
}
func EncodeURIComponent(s string) string {
return encodeURIComponent(s)
}
Loading…
Cancel
Save