Encode or decode URL components for safe use in query strings.
When you need URL encoding
Characters like spaces, &, and ? have special meaning in a URL. Encoding replaces them with safe escape sequences so they can be passed as query string values without breaking the URL.