github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/encoding/url_encoding.go (about) 1 package encoding 2 3 import "net/url" 4 5 func UrlEncoding(str string, charset string) (string, error) { 6 if s0, err := Convert(str, "UTF-8", charset); err == nil { 7 return url.QueryEscape(s0), nil 8 } else { 9 return "", err 10 } 11 } 12 13 func UrlDecoding(str string, charset string) (string, error) { 14 if s0, err := url.QueryUnescape(str); err != nil { 15 return "", err 16 } else { 17 return Convert(s0, charset, "UTF-8") 18 } 19 }