CGI-Utils
view release on metacpan or search on metacpan
You may also pass max_post_size in %params.
urlEncode($str)
Returns the fully URL-encoded version of the given string. It does not
convert space characters to '+' characters.
Aliases: url_encode()
urlUnicodeEncode($str)
Returns the fully URL-encoded version of the given string as unicode
characters. It does not convert space characters to '+' characters.
Aliases: url_unicode_encode()
urlDecode($url_encoded_str)
Returns the decoded version of the given URL-encoded string.
Aliases: url_decode()
urlUnicodeDecode($url_encoded_str)
Returns the decoded version of the given URL-encoded string, with
unicode support.
Aliases: url_unicode_decode()
urlEncodeVars($var_hash, $sep)
Takes a hash of name/value pairs and returns a fully URL-encoded query
string suitable for passing in a URL. By default, uses the newer
separator, a semicolon, as recommended by the W3C. If you pass in a
second argument, it is used as the separator between key/value pairs.
Aliases: url_encode_vars()
urlDecodeVars($query_string)
lib/CGI/Utils.pm view on Meta::CPAN
*url_encode = \&urlEncode;
};
}
}
=pod
=head2 urlUnicodeEncode($str)
Returns the fully URL-encoded version of the given string as
unicode characters. It does not convert space characters to '+'
characters.
Aliases: url_unicode_encode()
=cut
sub urlUnicodeEncode {
my ($self, $str) = @_;
$str =~ s{([^A-Za-z0-9_])}{sprintf("%%u%04x", ord($1))}eg;
return $str;
}
*url_unicode_encode = \&urlUnicodeEncode;
=pod
=head2 urlDecode($url_encoded_str)
Returns the decoded version of the given URL-encoded string.
Aliases: url_decode()
=cut
lib/CGI/Utils.pm view on Meta::CPAN
$str =~ s|%([A-Fa-f0-9]{2})|chr(hex($1))|eg;
return $str;
}
*url_decode = \&urlDecode;
=pod
=head2 urlUnicodeDecode($url_encoded_str)
Returns the decoded version of the given URL-encoded string,
with unicode support.
Aliases: url_unicode_decode()
=cut
sub urlUnicodeDecode {
my ($self, $str) = @_;
$str =~ tr/+/ /;
$str =~ s|%([A-Fa-f0-9]{2})|chr(hex($1))|eg;
$str =~ s|%u([A-Fa-f0-9]{2,4})|chr(hex($1))|eg;
return $str;
}
*url_unicode_decode = \&urlUnicodeDecode;
=pod
=head2 urlEncodeVars($var_hash, $sep)
Takes a hash of name/value pairs and returns a fully URL-encoded
query string suitable for passing in a URL. By default, uses
the newer separator, a semicolon, as recommended by the W3C. If
you pass in a second argument, it is used as the separator
between key/value pairs.
( run in 0.501 second using v1.01-cache-2.11-cpan-88abd93f124 )