On Sunday 03 February 2008 17:19, Alexander Kriegisch wrote:
> We all know that httpd can URL-decode strings, but there is no
> counterpart to do the opposite, i.e. URL-encode strings, in BusyBox. Do
> you think it would be useful to have such a little tool, maybe even as
> an optional (non-standard) httpd feature?
> 
> I know that URL encoding can be done via sed, e.g. like so (taken from
> the tool "Callmonitor" by Andreas Bühmann):
> 
> urlencode() {
> _urlencode '%\1' "$@"
> }
> 
> _urlencode() {
> local replacement=$1; shift
> local txt=$*
> case $txt in
> *[!0-9A-Z_a-z!*.-]*) ;;
> *) echo -n "$txt"; return ;;
> esac
> echo -e $(echo -n "$txt" |
> hexdump -v -e '/1 "!%02x"' |
> sed '
> s/!\(2[1ade]\|3[0-9]\|4[1-9a-f]\|5[0-9af]\|6[1-9a-f]\|7[0-9a]\)/\\x\1/g
> s/!\([[:xdigit:]]\{2\}\)/'"$replacement"'/g
> ')
> }
> 
> Denis, what do you think? Is there any chance of getting a C-coded
> little binary doing URL-encoding? BB's wget does not do it either,
> unfortunately.

why not? We can call them urlencode, urldecode, htmlencode, htmldecode
etc...
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to