note 61487 added to function.preg-replace
| From: | no-spam at idiot^org^ru | Date: | Sun, 05 Feb 2006 08:21:37 +0000 |
| Subject: | note 61487 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103015@lists.php.net to get a copy of this message | ||
decodes ie`s escape() result
<?
function unicode_unescape(&$var, $convert_to_cp1251 = false){
$var = preg_replace(
'#%u([\da-fA-F]{4})#mse',
$convert_to_cp1251 ?
'@iconv("utf-16","windows-1251",pack("H*","\1"))'
: 'pack("H*","\1")',
$var
);
}
//
$str = 'to %u043B%u043E%u043F%u0430%u0442%u0430 or not to
%u043B%u043E%u043F%u0430%u0442%u0430';
unicode_unescape($str, true);
echo $str;
?>
----
Server IP: 195.222.164.18
Probable Submitter: 217.118.66.232
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61487
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61487&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61487&report=yes
Search -- http://master.php.net/manage/user-notes.php