I’m trying to convert HTML Codes like the &#XXXX; (where XXXX is a number) to plain text using classic ASP (VBScript).
I’m adding the text to an email which is in plain text format and if I add them as HTML Codes, it just displays the code and doesn’t convert them.
One fix would be to change the email to be HTML which does fix that problem but then causes other problems for my email which I won’t go into.
Is there a built in function or a custom function I can use to convert these HTML Codes to plain text?
What you need is HTML Decode, though unfortunately ASP doesn’t include one.
This function, found on ASP Nut, and modified heavily by me, should do what you need. I tested it as vbscript running on my local computer and it seemed to work well, even with Unicode symbols in the 1000+ range.
Note: You’ll need script version 5.0 installed on your server to use the RegExp object.