Proper url encoding & extra trailing spaces