[Go]golang中的urlencode和urldecode

简单的字符串编码可以使用下面方式

    str := "aabb,&8?%s"
    ret := url.QueryEscape(str)
    log.Println(ret)

    encodedValue := "Hell%C3%B6+W%C3%B6rld%40Golang"
    decodedValue, err := url.QueryUnescape(encodedValue)
    log.Println(decodedValue, err)

输出结果

2021/08/14 11:35:12 aabb%2C%268%3F%25s
2021/08/14 11:35:13 Hellö Wörld@Golang <nil>

开源作品

GO-FLY,一套可私有化部署的免费开源客服系统,安装过程不超过五分钟(超过你打我 !),基于Golang开发,二进制文件可直接使用无需搭开发环境,下载zip解压即可,仅依赖MySQL数据库,是一个开箱即用的网页在线客服系统,致力于帮助广大开发者/中小站长快速整合私有客服功能
github地址:go-fly
官网地址:https://gofly.sopans.com

赞赏作者

微信交流

原文地址:https://www.cnblogs.com/taoshihan/p/15140487.html