URI::Encode::XS(3)
π NAME π
okay so bestie, welcome to URI::Encode::XS(3) from the User Contributed Perl Documentation section β itβs URI::Encode::XS, a Perl URI encoder/decoder using C. literally C under the hood, Perl in your hands β¨
β¨ SYNOPSIS β¨
use URI::Encode::XS qw/uri_encode uri_encode_utf8 uri_decode uri_decode_utf8/;
my $encoded = uri_encode($data);
my $decoded = uri_decode($encoded);
# utf8 friendly
my $encoded = uri_encode_utf8($data);
my $decoded = uri_decode_utf8($encoded);
πΈ DESCRIPTION πΈ
This is a Perl URI encoder/decoder written in XS, based on RFC3986 <https://tools.ietf.org/html/rfc3986>. This module always encodes characters that are not unreserved. When decoding, invalid escape sequences are preserved, e.g:
uri_decode("foo%20bar%a/"); # foo bar%a/
uri_decode("foo%20bar%a"); # foo bar%a
uri_decode("foo%20bar%"); # foo bar%
As of version 0.10, the bench script shows it to be significantly faster than URI::Escape:
Rate escape encode_utf8 encode
escape 140114/s -- -94% -98%
encode_utf8 2255100/s 1509% -- -71%
encode 7735189/s 5421% 243% --
Rate unescape decode_utf8 decode
unescape 188714/s -- -95% -97%
decode_utf8 3744638/s 1884% -- -50%
decode 7429263/s 3837% 98% --
However this is just one string - the fewer encoded/decoded characters are in the string, the closer the benchmark is likely to be (see bench for details of the benchmark). Different hardware will yield different results.
Another fast encoder/decoder which supports custom escape lists, is URI::XSEscape <https://metacpan.org/pod/URI::XSEscape>.
π INSTALLATION π
bestie, install it like this:
$ cpan URI::Encode::XS
Or:
$ git clone https://github.com/dnmfarrell/URI-Encode-XS
$ cd URI-Encode-XS
$ perl Makefile.PL
$ make
$ make test
$ make install
π«Ά CONTRIBUTORS π«Ά
- Aristotle Pagaltzis <https://github.com/ap>
- Christian Hansen <https://github.com/chansen>
- Jesse DuMond <https://github.com/JesseCanary>
π SEE ALSO π
URI::Escape<https://metacpan.org/pod/URI::Escape>URI::XSEscape<https://metacpan.org/pod/URI::XSEscape>URL::Encode<https://metacpan.org/pod/URL::Encode>- My article about the story of this module: The road to a 55x speedup with XS <http://perltricks.com/article/the-road-to-a-55x-speedup-with-xs/>
π REPOSITORY π
the repo lives at <https://github.com/dnmfarrell/URI-Encode-XS> β go vibe with it, bestie π¦
π LICENSE π
See LICENSE.
β AUTHOR β
Β© 2016 David Farrell
mwah π β page source/version: perl v5.42.2, dated 2026-02-15, for URI::Encode::XS(3). byeee, bestie π«Άβ¨
π¦ where this page comes from
- alpine 3.24: perl-uri-encode-xs-doc 0.11-r12 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms