urlencode
is a way of converting a URL to be used in the query string or other url-sensitive areas - when you don't want the url parsed by the browser. Your goal here is to print the actual URL because that's what the sitemap parser wants.
You can the keep the utf8-encode but it's not likely needed if you're already doing things using utf8.
Just use $durl=utf8_encode($durl);