Fix escaping of URI's containing special characters