use Exporter;
-our $VERSION = '1.0.23';
+our $VERSION = '1.0.24';
our @ISA = qw(Exporter);
our @EXPORT = ();
our @EXPORT_OK = (
# $t is the text to decode.
# $encoding is the encoding to use
# (if left empty, utf8 is assumed)
+# if $plus is true then '+' will be decoded to ' '.
sub url_decode {
- (my $t, my $encoding) = @_;
+ (my $t, my $encoding, my $plus) = @_;
if ($encoding eq '') {
$encoding = 'utf8';
}
+ if ($plus) {
+ $t =~ s/\+/ /gs;
+ }
$t =~ s/((%[0-9A-Fa-f]{2})+)/url_decode_xch($1, $encoding)/egs;
return $t;
}
my @list = split('&', $query);
foreach my $entry (@list) {
(my $name, my $value) = split('=', $entry, 2);
- $name = url_decode($name, $encoding);
- $value = url_decode($value, $encoding);
+ $name = url_decode($name, $encoding, 1);
+ $value = url_decode($value, $encoding, 1);
$data{$name} = $value;
}
return %data;