note 70921 added to function.html-entity-decode
| From: | jojo at osu1 dot php dot net | Date: | Sat, 04 Nov 2006 04:27:32 +0000 |
| Subject: | note 70921 added to function.html-entity-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119362@lists.php.net to get a copy of this message | ||
The decipherment does the character encoded by the escape function of JavaScript.
When the multi byte is used on the page, it is effective.
javascript escape('aaããaa') ..... 'aa%u3042%u3042aa'
php jsEscape_decode('aa%u3042%u3042aa')..'aaããaa'
<?
function jsEscape_decode($jsEscaped,$outCharCode='SJIS'){
$arrMojis = explode("%u",$jsEscaped);
for ($i = 1;$i < count($arrMojis);$i++){
$c = substr($arrMojis[$i],0,4);
$cc = mb_convert_encoding(pack('H*',$c),$outCharCode,'UTF-16');
$arrMojis[$i] = substr_replace($arrMojis[$i],$cc,0,4);
}
return implode('',$arrMojis);
}
?>
----
Server IP: 61.195.146.164
Probable Submitter: 202.232.38.130
----
Manual Page -- http://www.php.net/manual/en/function.html-entity-decode.php
Edit -- https://master.php.net/note/edit/70921
Del: integrated -- https://master.php.net/note/delete/70921/integrated
Del: useless -- https://master.php.net/note/delete/70921/useless
Del: bad code -- https://master.php.net/note/delete/70921/bad+code
Del: spam -- https://master.php.net/note/delete/70921/spam
Del: non-english -- https://master.php.net/note/delete/70921/non-english
Del: in docs -- https://master.php.net/note/delete/70921/in+docs
Del: other reasons-- https://master.php.net/note/delete/70921
Reject -- https://master.php.net/note/reject/70921
Search -- https://master.php.net/manage/user-notes.php