Forcing %s to escape spaces with plus instead of percent twenty

You don't need to use the REST style of searching, but can instead use normal HTTP GET parameters like this:

http://www.metacritic.com/search/all/results?search_term=test+query

So in your case that would be:

http://www.metacritic.com/search/all/results?search_term=%s

Unfortunately, this doesn't work with Metacricic (?).

The best I could get is the following search function, however it doesn't really redirect for some reason:

data:text/html;charset=utf-8,<script>var s = "%s"; s = s.replace("%20", "+"); var url = "http://www.metacritic.com/search/all/" + s + "/results"; window.location = url;</script>

Background info:

Chrome encodes the sent parameters depending on the position, i.e. if its within an URL or as a GET parameter. Within an URL it makes sense to convert a space to %20, whereas in a parameter the + is used.

Unfortunately, they're not up to changing this behavior, so my guess would be that a simple line of Javascript could fix this. I'll look into it.


Though a bit crude, you can create a simple Chrome extensions that adjusts the URL for metacritic (or other sites if you want)

Here's the code I've used for a Metacritic Search URL Replace extension:

manifest.json:

{
    "content_scripts": [ {
    "include_globs": [ "http://www.metacritic.com/search/*%20*" ],
    "js": [ "script.js" ],
        "matches": [ "http://*/*", "https://*/*" ],
        "run_at": "document_start"
    } ],
    "converted_from_user_script": true,
    "description": "Replaces '%20' in metacritic search request to '+'",
    "name": "Metacritic search replacer",
    "version": "0.1"
}

script.js:

window.location = window.location.href.replace(/%20/g, "+");

Since I don't really have a reliable spot to upload my extension, here are the instructions to create a Chrome extension using these two files:

First, put the two files in a folder somehwere and browse to chrome://extensions. Make sure the developer mode is active (look at the top right of the page to enable this). Here you can select 'Pack extension..' which asks you for the folder where your script resides. Once you have selected this folder, the extension will be created and you can just drag & drop it into Chrome to install. If everything went according to plan, the script will rewrite the URL for a Metacritic search request from the '%20' to the '+' characters.

Now, you can use http://metacritic.com/search/all/%s/results as a search engine url in Chrome itself to use a shortcut to this search.

Hope this helps.. ;)


As pointed out by slhck in his answer, Chrome only supports %s, and insists on "intelligently" determining whether to use plus symbols or %20 to escape spaces (see Chromium bug 78429).

The particular test case I'm dealing with (metacritic.com) imposes too many hoops to leap through concurrently with their RESTful search interface.

Therefore, as a work-around, I elected to simply use app.metacritic.com's legacy interface:

http://apps.metacritic.com/search/process?tfs=game_title&sb=0&game_platform=PC&­ts=%s

If that hadn't been available, I would have contacted metacritic.com, referred them to the Chromium bug, and begged for mercy. :-)