note 48180 rejected from function.rawurlencode by betz
| From: | betz@php.net | Date: | Wed, 15 Dec 2004 22:11:43 +0000 |
| Subject: | note 48180 rejected from function.rawurlencode by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81839@lists.php.net to get a copy of this message | ||
Note Submitter: dave at xmouse dot ithium dot net
----
Be careful! rawurldecode()ing a string that has been rawurlencode()d will NOT return the original
string, but the original string with slashes added. Example:
<?php
$s = 'hello"world';
echo rawurldecode(rawurlencode($s));
//outputs 'hello\"world' ?>
To get the original string, you need to call stripslashes() on top of those two calls.
<?php
$s = 'hello"world';
echo stripslashes(rawurldecode(rawurlencode($s)));
//outputs 'hello"world'
?>