Skip to main content
urlencode(str) percent-encodes str so it is safe to use as a URL query parameter or path segment. Special characters like spaces, &, =, and / are encoded.

Signature

Example

Build a search query URL for a monitoring dashboard link in a release notification:

Notes

  • urlencode encodes the entire string, including characters that are valid in some URL parts (like /). It is intended for query parameter values and similar contexts where the entire value must be escaped.
  • Spaces are encoded as +, following the application/x-www-form-urlencoded format used by url.QueryEscape. If your target requires %20 for spaces, replace + with %20 after encoding.