Re: url-escaping a string in a shell script.
On Sat, Jul 21, 2001 at 03:11:06PM +0200, Martin F. Krafft wrote:
> also sprach Joost Kooij (on Sat, 21 Jul 2001 01:56:26PM +0200):
> > perl -MURI::Escape -ne 'chomp; print uri_escape($_), "\n"'
> >
> > A little scriptlet to do the same:
> >
> > #!/usr/bin/perl -w
> > use URI::Escape;
> > chomp, print uri_escape($_), "\n" while (<>);
>
> almost, except that an input of "$1$29492948$6uK7lvoFHD2wWI.P.yF111"
> is output as "$1$29492948$6uK7lvoFHD2wWI.P.yF111" even though the '$'
> character needs to be escaped for HTTP... why?
Why needs the '$' character be escaped for http?
If you insist on escaping everything, use:
uri_escape("foo", "\0-\377")
Of course, this is all explained in the URI::Escape manual page.
Cheers,
Joost
Reply to: