note 81442 deleted from function.urlencode by peehaa

From: Date: Fri, 06 Jan 2017 15:51:43 +0000
Subject: note 81442 deleted from function.urlencode by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208697@lists.php.net to get a copy of this message
Note Submitter: kerdster at gmail dot com ---- > php dot net at samokhvalov dot com > 12-Dec-2006 09:49 Thanx for idea! I have wrote more simple function based on your function to simulate JS function escape (); It uses mb_string functions unstead of iconv. <?php function utf16urlencode($str) { $str = mb_convert_encoding($str, 'UTF-16', 'UTF-8'); $out = ''; for ($i = 0; $i < mb_strlen($str, 'UTF-16'); $i++) { $out .= '%u'.bin2hex(mb_substr($str, $i, 1, 'UTF-16')); } return $out; } ?>

« previous php.notes (#208697) next »