Removing obscure chars

Giganews Newsgroups
Subject: Removing obscure chars
Posted by:  Laphan (in…
Date: Tue, 3 Apr 2007

Hi All

I have an ASP function in place to strip invalid chars out of a data store
before I create an XML file of this data, but my function doesn't work on a
certain set of chars.

As far as I can see these are the following:

a) trademark char
b) long hyphen/dash char
c) smart/curly quotes (both left and right)

Even though my function is set up as follows:

Function ReFormatStringForXML(s)
IF LEN(s) > 0 AND NOT IsNull(s) THEN
  s = Replace(s,"™","™")
  s = Replace(s,"—","-")
  s = Replace(s,"’",""")
  s = Replace(s,"'",""")
  s = Replace(s,"""",""")
  s = Replace(s,"&","&")
  s = Replace(s,"<","&lt;")
  s = Replace(s,">","&gt;")
ReFormatStringForXML = s
End Function

These chars still pass by and foul up my XML file.

I have a feeling that its down to the fact that my function is looking for
the html equiv rather than the actual char, but I can't possibly get away
with simply copy and pasting these friggin(!!) chars into my function.
Surely this is bad practise?

Does anybody know how I can trap and replace/remove these chars if need be?