On OSX when I try to open a url that contains a hash #
, it gets converted to %23 and it fails. For example,
From the command prompt,
$ open "https://translate.google.com/#auto/en/ру́сский+язы́к"
gives me an Error 404
from google
The requested URL /%23auto/en/%D1%80%D1%83%CC%81%D1%81%D1%81%D0%BA%D0%B8%D0%B9+%D1%8F%D0%B7%D1%8B%CC%81%D0%BA was not found on this server. That’s all we know.
The same happens from Applescript as well when I use the open location
command.
Is this happening at my end or from googles? How can I get these urls to work? According to this answer it should work.
EDIT:
I disabled my internet connection and then tried to open the above url and the results was the same, #
was turned into %23
. Also tried Chrome, I was using Firefox, and the result is the same. So the change is happening by OSX itself.
By the way, if you copy and paste the above into your browser it will work just fine, so the url is fine as is.
Lastly, I am using Snow Leopard (10.6.8)
SOLVED: As per the answer below, the query string had to be encoded. The one liner in this answer helped,
/bin/echo -n "some foreign text" | php -r "echo urlencode(file_get_contents('php://stdin'));"