note 99322 modified in function.html-entity-decode by danbrown
| From: | danbrown@php.net | Date: | Tue, 10 Aug 2010 19:27:37 +0000 |
| Subject: | note 99322 modified in function.html-entity-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171553@lists.php.net to get a copy of this message | ||
This is a safe rawurldecode with utf8 detection:
<?php
function utf8_rawurldecode($raw_url_encoded){
$enc = rawurldecode($raw_url_encoded);
if(utf8_encode(utf8_decode($enc))==$enc){;
return rawurldecode($raw_url_encoded);
}else{
return utf8_encode(rawurldecode($raw_url_encoded));
}
}
?>
--was--
This is a safe rawurldecode with utf8 detection:
function utf8_rawurldecode($raw_url_encoded){
$enc = rawurldecode($raw_url_encoded);
if(utf8_encode(utf8_decode($enc))==$enc){;
return rawurldecode($raw_url_encoded);
}else{
return utf8_encode(rawurldecode($raw_url_encoded));
}
}
http://php.net/manual/en/function.html-entity-decode.php