Skip to content

Instantly share code, notes, and snippets.

@zxh
Created March 28, 2018 10:03
Show Gist options
  • Save zxh/85f4e6824efda426f50d5cb43d296aef to your computer and use it in GitHub Desktop.
Save zxh/85f4e6824efda426f50d5cb43d296aef to your computer and use it in GitHub Desktop.
goalng url encode, query param encode, path escape, query escape, space escape
package main
import (
"fmt"
"net/url"
)
func main() {
fmt.Println("Path参数中对空格的转义:"+url.PathEscape("hello world"))
fmt.Println("Query参数中对空格的转义:"+url.QueryEscape("hello world"))
fmt.Println("Path参数中对➕的转义:"+url.PathEscape("hello world+abc"))
fmt.Println("Query参数中对➕的转义:"+url.QueryEscape("hello world+abc"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment