URI encode path to prevent EOF error