Preserve plus signs and ampersands in demo search URLs
Build search parameters from raw values with URLSearchParams so a plus sign or ampersand in the user's input survives the round trip. A prototype may work with a single word and fail with a team name such as C++ & design. Concatenating that value into a query string gives punctuation another job: an ampersand can separate parameters, and a plus sign in form-style query syntax can be decoded as a space. Rehearse a value that contains both characters. Use a URL object for the full address, then set the unencoded input value on its searchParams.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in