encode url first