1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
$titre = (string)$movie->title;
$titre = unicode_urldecode($titre);
$titre = preg_replace('/&#\d{2,5};/ue', "utf8_entity_decode('$0')", $titre);
$titre = iconv("ISO-8859-2", "UTF-8",$titre);
$titre = mb_convert_encoding( $titre, "utf-8", "HTML-ENTITIES" );
$titre = unicode_decode($titre,'ISO-8859-1');
$titre = html_entity_decode((string)$movie->title);
//Function to decode URL's that contain Unicode characters
function unicode_urldecode($url)
{
//split the URL into an array
$url_array = split ("%",$url);
//Make sure we have an array
if (is_array($url_array))
{
//Loop while the key/value pair of the array
//match our list items
while (list ($k,$v) = each ($url_array))
{
//use base_convert to convert each character
$ascii = base_convert ($v,16,10);
$ret .= chr ($ascii);
}
}
//return the decoded URL
return ("$ret");
} |
Partager