What's with the %20 on Safari?

Fairly frequently when searching for something in Safari, I get a page that says ‘Safari can’t open the page… Safari can’t open the page “[text]%20[text]%20[text]%20[text]” because the page’s address isn’t valid.’

Why is this happening, and is there a fix for it?

“%20” is the URL encoding for “space”. URLs can’t have spaces (or most “special” characters) in them, so if you try to create one with a space in it, that’s how it is represented.

I don’t know that that is your problem, though. A URL with some %20s in it is still “valid”.

‘%20’ represents the hexadecimal code for a ‘space’, which often does not work well in a URL…

I’m not typing in a URL. I’m doing a search.

Like, suppose I wanted to look for a review of a restaurant (as in this case). I type the name of the restaurant and the city and the state abbreviation. I would expect to get google returns with links to pages that contain reviews of the restaurant. Instead, I got the ‘can’t open’ page. It also happens somewhat frequently when I type in a given name and a surname.

That’s what you think. Sounds like you’re requesting a page with that address, not using Google or something. Did you recently reconfigure the browser (or let it reconfigure itself) to not process entries in the address bar as searches? Are your default search engines configured correctly? Is there a separate box for searches, beside the address bar, that wasn’t there, say, last week?

What application/widget are you using to do the search?

If you are doing a (Google) search, a URL should be being constructed on your behalf, looking something like:

https://www.google.com/search?q=<encoded search query>

Since the search query is allowed to have spaces, but URLs are not, the spaces are encoded as “%20”, which is where those come from.

If whatever app is trying to do the search is not constructing that URL as expected, then there will be problems. From the error message, it doesn’t seem to be constructing something that safari recognizes even as a URL.

There is no separate box for searches. There used to be one many years ago, but it went away with a newer version of Safari. The version I’m using (15.5) looks similar to this, with only one box:

Normally, you type what you’re looking for there and you get google results. But sometimes it interprets the search as a URL.

And one of the criteria for figuring out you want a search and not a URL is whether it contains spaces.

Anyways, my answer to the OP would be to check out your search settings and perhaps clear your cookies for your search provider.

Other than that, I can only recommend what I’d do, and google if anyone else has run I to this problem.

Here’s something from 2015.

It’s supposed that if I want to make a search in Safari I can put the question in the address bar. What is strange is that sometimes Safari deals the question as an address. For instance, I put: “translate french to english” and Safari says Safari can’t find the server. Safari can’t open the page “translate%20to%20%20english” because Safari can’t find the server “translate franch to english”

It’s a random error that can happen with any link at any time, but it will work 90% of the time. However, once it occurs, then it will continue giving the same issue for some time unless you restart Safari (which is less than ideal as I often find myself logged out of several sessions).

It does indeed seem random. I repeated the search that prompted this thread, and this time I was given search results.

Speculation: Maybe safari depends on an external service to determine whether text in the box is supposed to be a URL or a search, and sometimes that service drops requests and safari defaults to trying to interpret as a URL.

What happens if you disconnect from the network entirely?

Disconnect from the Internet?

The problem is that I never know what’s going to be interpreted as a URL and what isn’t. As the poster said years ago, it works 90% of the time.

Try un-checking everything in Preferences/Search such as search engine suggestions, safari suggestions, quick website search, etc.