--- Dick Russel <[EMAIL PROTECTED]> wrote: > Duane A. Couchot-Vore wrote: > > > > > > It's an illegal URI because the ampersand in the password appears > > unencrypted, which tells the server it is the beginning of a new query > > string parameter. Use encodeURIComponent() in you Javascript to > > encode the password and urldecode() in your PHP to change it back. > > > > --- In [email protected] <mailto:php-list%40yahoogroups.com>, > > Dick Russel <[EMAIL PROTECTED]> wrote: > > Thanks, now I have the entire string and according to the php manual I > should be able to decode the URL with rawurldecode() > http://us3.php.net/manual/en/function.rawurldecode.php > > But for some reason I am unable to translate the string back to the > original version. > > Original: %^&*()_+{}|:"< >?`1 > Passed: %^&*()_+{}|:"< >?`1 > rawurldec:%^&*()_+{}|:"< >?`1 > > Any idea why it won't decode? Do I have to write my own decode function? > The test code is: > $decode = rawurldecode($_GET['worootp']); > echo $decode;
Converting the ampersand (&) to & is used for html entities. This is different from the usual output of a PHP function like urlencode(). For example, a space character converts to %20 with urlencode(). The urldecode() function reverses this but it is often not necessary. With the encoding you are illustrating, you should use html_entity_decode() in PHP: http://us.php.net/manual/en/function.html-entity-decode.php I wonder if the wrong Javascript function has been suggested. It will work but is not as elegant as it could be. Really long URLs could run into the ~2,000 character limit for IE. James Keeline
