International char problem eg ä

I have written a simple web proxy server which is currently choking on
links containing international characters.

Below is a fictitious link which my proxy server might find in a web
page(<IMG src=“…”). It contains a ä (a with 2 dots) in the jpg
filename

http://www.qqqq.se/pics/b&auml;r.jpg

If my proxy sever tries to Get the page pointed to by the link then the
result is Page Not Found. If I paste the link into Firefox I again get
Page Not Found

If I change the ä to %E4 then it works in firefox (and I assume
Ruby) eg

http://www.qqqq.se/pics/b�r.jpg

So I am looking for a function which converts HTML representations to
Hex in a string

I thought CGI.unencodeHTML might do the trick but it only converts a few
characters (HTML syntax I think) such as < and >

Any ideas?

Peter