package main

import (
    "fmt"
    "net/url"
)

func main() {
    str := "Hello, World!"

    // path escaping should be used when the string is used as part of a path
    // and similarly, query escaping should be used when the string is part
    // of the value of a query string. there are differences in how the strings
    // are encoded.
    fmt.Println(url.PathEscape(str))
    fmt.Println(url.QueryEscape(str))
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: