Use urlencode instead of manual character replacement