Page 1 of 1

Cleaning hex codes from HTML/XML eg %20, $2D

Posted: Wed Apr 23, 2003 2:32 am
by mike
I am trying to replace all the hex codes in an HTML/XML format file with their ASCII equivalents. For example I want to replace %20 with a space, %3A with : and so on.

Obviously there are many possibilities. I can find them all with this RE:

%\([:xdigit:]\{2\}\)

But I can't work out how to code the replace RE. I thought it would be:

\x\1

... but this just replaces the % with \x.

Here's a sample of what I am trying to achieve:

Before:

Web%20Address%3A

After

Web Address:

Any ideas?

Thanks
Mike

use javascript instead

Posted: Fri May 02, 2003 2:53 am
by mike
it seems other tools can do this better. someone suggested perl. i am using javascript, which has an unencode function which does exactly what I described.
mike