NAME
URI::Encode - Simple URI Encoding/Decoding
VERSION
This document describes URI::Encode version 0.02
SYNOPSIS
## OO Interface
use URI::Encode;
my $uri = URI::Encode->new();
my $encoded = $uri->encode($url);
my $decoded = $uri->decode($encoded);
## Using exported functions
use URI::Encode qw(uri_encode uri_decode);
my $encoded = uri_encode($url);
my $decoded = uri_decode($url);
DESCRIPTION
This modules provides simple URI (Percent) encoding/decoding. This module borrows from URI::Escape, but 'tinier'
METHODS
new()
Creates a new object, no argumetns are required
my $encoder = URI::Encode->new();
encode($url, $including_reserved)
This method encodes the URL provided. The method does not encode any "Reserved Characters" unless $including_reserved
is true. The $url provided is first converted into UTF-8 before percent encoding.
$uri->encode("http://perl.com/foo bar"); # http://perl.com/foo%20bar
$uri->encode("http://perl.com/foo bar", 1); # http%3A%2F%2Fperl.com%2Ffoo%20bar
decode($url)
This method decodes a 'percent' encoded URL. If you had encoded the URL using this module (or any other method), chances are that the URL was converted to UTF-8 before 'percent' encoding. Be sure to check the format and convert back if required.
$uri->decode("http%3A%2F%2Fperl.com%2Ffoo%20bar"); # "http://perl.com/foo bar"
EXPORTED FUNCTIONS
The following functions are exported upon request. This provides a non-OOP interface
uri_encode($url, $including_reserved)
See "encode($url, $including_reserved)"
uri_decode($url)
See "decode($url)"
CHARACTER CLASSES
Reserved Characters
The following characters are considered as reserved (RFC 3986). They will be encoded only if requested.
! * ' ( ) ; : @ & = + $ , / ? % # [ ]
Unreserved Characters
The following characters are considered as Unreserved. They will not be encoded
a-z
A-Z
0-9
- _ . ~
DEPENDENCIES
ACKNOWLEDGEMENTS
Gisle Aas for URI::Escape
David Nicol for Tie::UrlEncoder
SEE ALSO
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-uri-encode@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
Mithun Ayachit <mithun@cpan.org>
LICENCE AND COPYRIGHT
Copyright (c) 2010, Mithun Ayachit <mithun@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.