URL/HTML encoding

Hey guys, looking for a way to encode a string into URL and HTML in a bash script that I'm making to encode strings in various different digests etc.
Can't find anything on it anywhere else on the forums.
Any help much appreciated, still very new to bash and programming etc.

Post a detailed example of what you want to accomplish.

this-is-a-string

And convert it into

URL-encoded:
%74%68%69%73%2D%69%73%2D%61%2D%73%74%72%69%6E%67

HTML:
&#116&#104&#105&#115&#45&#105&#115&#45&#97.....

Alternatively if there is a way to replace the original characters with their encoded equivalents, ie:

"a" into "%61" or "&#97", URL-encoded and HTML respectively.

I found some awk programs here that might help you with URL/HTML Encoding.

Check out this info:
URL encoding/decoding with shell script