Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing Non-ASCII Charaters 1

Status
Not open for further replies.

hc98br

ISP
Aug 14, 2003
46
Hi, I'm having difficulty finding a solution to this problem, any help would be wonderful!!

I have some text that has loads of non-ascii characters in it - and I want to take them out, and have found the following code which works lovely!!:
Code:
Dim newDesc
Set objRegExp = New RegExp
objRegExp.Global = True
objRegExp.IgnoreCase = True
objRegExp.Pattern = "[^\x20-\x7E]"
newDesc = objRegExp.Replace(dataRS("description"), "")

Problem is I don't just want to lose the rouge characters, I want to convert them into HTML friendly character codes (e.g. ⃻) and I'm at a loss.

I tried, objRegExp.Replace(dataRS("description"), Asc("$&")), but it just returns the code of the $.

Many thanks in advance


Ben.



 
The Asc() function returns an integer representing the character code corresponding to the first letter in a string.
 
Have you experimented with the Server.HTMLEncode method?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top