<% function cleanXML(textToClean) mydebug("cleaning raw text") if not textToClean="" then Dim fixlist(24) fixlist(1)="pound" fixlist(2)="copy" fixlist(3)="emdash" fixlist(4)="apos" fixlist(5)="eacute" fixlist(6)="egrave" fixlist(7)="ccedil" fixlist(8)="iacute" fixlist(9)="ecirc" fixlist(10)="uacute" fixlist(11)="atilde" fixlist(12)="oacute" fixlist(13)="aacute" fixlist(14)="otilde" fixlist(15)="ocirc" fixlist(16)="ouml" fixlist(17)="uuml" fixlist(18)="auml" fixlist(19)="raquo" fixlist(20)="laquo" fixlist(21)="reg" fixlist(22)="Acirc" fixlist(23)="cent" fixlist(24)="eth" cleanXML=Trim(textToClean) for each entity in fixlist cleanXML=replace(cleanXML, "&" & entity & ";", "&" & entity & ";", 1, -1, 1) next Dim numArr 'numArr=Array (148, for c = 145 to 153 cleanXML = Replace(cleanXML, Chr(c), Server.htmlencode(Chr(c)), 1, -1, 1) next cleanXML=replace(cleanXML, "’", "'", 1, -1, 1) cleanXML=replace(cleanXML, "‘", "'", 1, -1, 1) cleanXML=replace(cleanXML, "’", "'", 1, -1, 1) cleanXML=replace(cleanXML,"…","...",1,-1,1) cleanXML=replace(cleanXML, "<", vbnewline & "<", 1,-1,1) cleanXML=replace(cleanXML, "&#", "&#", 1, -1, 1) cleanXML=replace(cleanXML, " & ", " & ", 1, -1, 1) cleanXML=replace(cleanXML, vblf, vbcr, 1, -1, 1) cleanXML=replace(cleanXML, vbcr, vbnewline, 1, -1, 1) cleanXML=replace(cleanXML, vbnewline & "", vbnewline & "", 1, -1, 1) cleanXML=replace(cleanXML, "", vbnewline & "", 1, -1, 1) cleanXML=replace(cleanXML, "", vbnewline & "", 1, -1, 1) cleanXML=replace(cleanXML, vbnewline & vbnewline, vbnewline, 1, -1, 1) cleanXML=Trim(cleanXML) 'dim strloc 'strloc=Instr(cleanXml, "Copyright 2002") 'mydebug(strloc) 'mydebug("chr: " & mid(cleanXML, strloc-2, 1)) Dim startPos startPos=Instr(cleanXML, "<") 'mydebug(cleanXML) if not startPos=0 then cleanXML=Mid(cleanXML, startPos, Len(cleanXML)) end if end if end function %>