ID: 23063
User updated by: mccarthy36 at earthlink dot net
Reported By: mccarthy36 at earthlink dot net
Status: Wont fix
Bug Type: Feature/Change Request
Operating System: All
PHP Version: 4.3.1
New Comment:
That's true. You could also do the following and dispense with the
built in functions entirely, but it's not very convenient (and perhaps
less efficient?).
preg_replace( array( '/[^\w. -]/e', '/ /' ), array( "sprintf( '%%%02X',
ord( '\\0' ) ) ", '+' ), $foo_original );
preg_replace( '/[^\w.-]/e', "sprintf( '%%%02X', ord( '\\0' ) )",
$foo_original );
That's some pretty complicated code, that you have to go through the
hassle of carrying around with you everywhere you need it, to perform a
pretty simple action. I don't understand why you just automatically
decided to condemn this to "Wont fix". It seems like it would be
pretty simple to implement, and the change I suggested wouldn't
interfere with anything. The usefulness / necessity is self-evident
and demonstrated by the existence of the current built in functions.
Previous Comments:
------------------------------------------------------------------------
[2003-04-05 12:44:44] [EMAIL PROTECTED]
You can achieve the same results using preg_replace:
preg_replace('/./e',"sprintf('%%%02X',ord('\\0'))",$foo);
The resulting string can be parsed by any RFC compliant query string
decoder.
------------------------------------------------------------------------
[2003-04-05 11:29:14] mccarthy36 at earthlink dot net
I'd like to see an optional boolean second argument to urlencode() and
rawurlencode() to cause encoding of all characters in the argument
string, even alphanumerics.
Like this:
string urlencode ( string str [, bool encode_all])
string rawurlencode ( string str [, bool encode_all])
Naturally the optional argument would default to false to preserve the
current behavior.
Thanks
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23063&edit=1