Allora la stringa decodificata esce:
°."°".diventa fan."°".° ©
dovrebbe uscire
°.•°•.★diventa fan★.•°•.° ©
Ci deve essere qualche cosa che non va..
magari mb_... boh
Codice PHP:
<?php
function unicode_decode($str){
return preg_replace("#/u([0-9A-F]{4})#ie", "hex2str(\"$1\")", $str);
}
function hex2str($hex) {
$r = '';
for ($i = 2; $i < strlen($hex) - 1; $i += 2){
$r .= chr(hexdec($hex[$i] . $hex[$i + 1]));
}
return $r;
}
$text = "Grazie mille per l'aiuto, \n\n\u00b0.\u2022\u00b0\u2022.\u2605diventa fan\u2605.\u2022\u00b0\u2022.\u00b0 \u00a9";
$text = str_replace("\u", "/u", $text);
$stringa_de_codificata = unicode_decode($text);
echo $stringa_de_codificata;
?>
(fatto con l'aiuto di dascos)