Fix bug when URL encoding all characters in a string