URL Decoding in PHP
Actually, you get the desired output, but it is not interpreted as UTF-8. If this is on an HTTP application, you should send a header or a meta tag (or both) which would tell the client to use UTF-8.
Edit: for example:
// replace text/html with the content type you're using
header('Content-Type: text/html; charset=UTF-8');
Your string is also UTF-8 encoded. This will work:
echo utf8_decode(urldecode("Ant%C3%B4nio+Carlos+Jobim"));
Output: "Antônio Carlos Jobim".
when I do
<?php
echo urldecode("Ant%C3%B4nio+Carlos+Jobim");
?>
Its display correctly in my browser like
Antônio Carlos Jobim
I have tested with XAMPP
another option is:
<?php
$smthing = 'http%3A%2F%2Fmysite.com';
$smthing = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($smthing));
$smthing = html_entity_decode($smthing,null,'UTF-8');
echo $smthing;
?>
output becomes : http://mysite.com