[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

urlencode/decode function (unescape)

Posted on 1998-10-01
3
Medium Priority
?
3,506 Views
Last Modified: 2012-06-22
I have urlencoded data (in a database). Retrieving the data is no problem. I wonder if there is an easy way to decode the data. I can write my own function (that is no problem) but it seems likely to me that perl has an inbuilt function for this (which does the same as unescape in javascript).

How do I easily urldecode in perl.

I have found:

use URI::Escape;
and then I can use the function "uri_unescape()", but it does not convert "+" to space. (javascript unescape does that too).
0
Comment
Question by:sybe
  • 2
3 Comments
 
LVL 28

Author Comment

by:sybe
ID: 1205056
Edited text of question
0
 
LVL 5

Accepted Solution

by:
b2pi earned 150 total points
ID: 1205057
I'm not sure why the + should be converted to a ' '.  It's not
mentioned in RFC 1630.  However, should you want to do this manually,
you should do it _before_ passing it to uri::uri_unescape i.e.

$data =~ s/([^\\])\+/$1 /g;
$data = uri_unescape($data);

0
 
LVL 28

Author Comment

by:sybe
ID: 1205058
It works (but so did the thing I wrote).
The encoding from " " to "+" was done by ASP/VBScript. What I was really looking for was one function to do it all, but that probably is not present in perl.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question