note 77860 added to function.urlencode

From: Date: Sun, 16 Sep 2007 20:13:40 +0000
Subject: note 77860 added to function.urlencode
Groups: php.notes 
Request: Send a blank email to php-notes+get-130541@lists.php.net to get a copy of this message
Like "ahrensberg at gmail dot com" earlier has writen, you can have problems with encode strings with special characters to flash. <?php function flash_encode($string) { $string = rawurlencode(utf8_encode($string)); $string = str_replace("%C2%96", "-", $string); $string = str_replace("%C2%91", "%27", $string); $string = str_replace("%C2%92", "%27", $string); $string = str_replace("%C2%82", "%27", $string); $string = str_replace("%C2%93", "%22", $string); $string = str_replace("%C2%94", "%22", $string); $string = str_replace("%C2%84", "%22", $string); $string = str_replace("%C2%8B", "%C2%AB", $string); $string = str_replace("%C2%9B", "%C2%BB", $string); return $string; } ?> Add 3 more lines, and it works correct for me: <?php function flash_encode($string) { $string = rawurlencode(utf8_encode($string)); $string = str_replace("%C2%96", "-", $string); $string = str_replace("%C2%91", "%27", $string); $string = str_replace("%C2%92", "%27", $string); $string = str_replace("%C2%82", "%27", $string); $string = str_replace("%C2%93", "%22", $string); $string = str_replace("%C2%94", "%22", $string); $string = str_replace("%C2%84", "%22", $string); $string = str_replace("%C2%8B", "%C2%AB", $string); $string = str_replace("%C2%9B", "%C2%BB", $string); $string = str_replace("83%C2%", "", $string); $string = str_replace("C3%83-", "C3%96", $string); $string = str_replace("%C3%83%22", "%C3%84", $string); return $string; } ?> ---- Server IP: 217.160.72.57 Probable Submitter: 62.202.82.163 ---- Manual Page -- http://www.php.net/manual/en/function.urlencode.php Edit -- https://master.php.net/note/edit/77860 Del: integrated -- https://master.php.net/note/delete/77860/integrated Del: useless -- https://master.php.net/note/delete/77860/useless Del: bad code -- https://master.php.net/note/delete/77860/bad+code Del: spam -- https://master.php.net/note/delete/77860/spam Del: non-english -- https://master.php.net/note/delete/77860/non-english Del: in docs -- https://master.php.net/note/delete/77860/in+docs Del: other reasons-- https://master.php.net/note/delete/77860 Reject -- https://master.php.net/note/reject/77860 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130541) next »