Is there a way to encode a text as a URL?
So from bar "foo" then "foo% 20bar" are.
The offers httpd's just not the way back, but.
Is there another tool that could help me?
Matze
Edit:
My current solution is:
I have a file "/ tmp / flash / urlencode.sed created" with the following contents: Code:
s / /% 20 / g
s /: /% 3A / g
s / (/% 28 / g
s /) /% 29 / g
s /, /% 2C / g
s / ü /% C3% BC / g
s / ä /% C3% A4 / g
s / ö /% C3% B6 / g
s / ß /% C3% 9F / g
s /, /% 3B / g
s / ~ /% 7e / g
s /! /% 21 / g
s / "/% 22 / g
s / # /% 23 / g
s / $ /% 24 / g
s / & /% 26 / g
s / @ /% 40 / g
s / [/% 5b / g
s / /% 5c / g
s / ] /% 5d / g
s / _ /% 5f / g
s / `/% 60 / g
s / (/% 7b / g
s / | /% 7c / g
s /) /% 7d / g
the ecoding, into the variable "text" standing, message calling on because I do then Code:
text = $ (echo "$ text" | sed-f / var / tmp / flash / urlencode.sed)
Which I then trailed to the URL example Code:
wget "http://bsp.tdl/listener.php?msg = $ text"
But maybe someone else knows another solution?
More compact the Andreas Bühmann makes the call monitor. Excerpt from
url.sh: Code:
urlencode () (
_urlencode '% 1' "$ @"
)
_urlencode () (
local replacement = $ 1; shift
local txt = $ *
case $ txt
* [! 0-9A-z-Z_a !*.-]*);;
*) Txt echo-n "$"; 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
')
)
Short Test this:
Code:
# URL encoding
$ Urlencode "bad girls have to wash the feet too!"
B%% 20M% f6se e4dchen% 20m% fcssen 20auch%% 20the% 20F% fc 20waschen% dfe%!
# Crosscheck
$ Httpd-d $ (urlencode "bad girls have to wash the feet!")
Bad girls need to wash the feet!