A podcast search box accepts ordinary language. That includes spaces, accents, Japanese characters, plus signs, and titles containing an ampersand. A URL has its own syntax, so joining the raw query to a string can change what the server receives.

For example, science & society should remain one search query. It must not become a query called “science ” followed by an unrelated URL parameter.

Let a URL builder do the work

Create a URL object for your search route. Add the query with URLSearchParams or your platform's equivalent. Add sort and type as separate parameters. Do not encode the whole URL after building it, because that also changes separators the URL needs.

Keep the original text in the input. The percent-encoded form belongs in the request, not in the label shown to a listener. Avoid encoding a value twice when moving it between a router and an API client.

Validate fixed options separately. If your interface offers relevance or recency, map those options to the documented values. Do not copy an arbitrary sort value from a public URL directly into a database or another service.

Use a small test set

Try a title with &, one with +, a phrase with a slash, and a non-Latin title. Inspect the value received by a local test endpoint. It should match the intended text after one normal decode.

Also test an empty value and leading or trailing spaces. Decide whether your product trims them before sending, then use that same rule in saved searches.

A shared URL builder keeps these decisions in one place. It is easier to review than several screens each assembling search strings in slightly different ways.