encode URI before opening