[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: url-escaping a string in a shell script.



On Sat, Jul 21, 2001 at 01:37:26PM +0200, Martin F. Krafft wrote:
> hi,
> assuming that i have a string of the form "123%%%blabla*($(" available
> in the shell script, how can i convert that into an escaped version
> for use with the HTTP protocol? i am not a perl wizard, or else i
> wouldn't ask. and maybe there is a better way.

  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 (<>);

Cheers,


Joost



Reply to: