> being displayed as > in browser and not >

Flocoolle

New Member
I am trying to convert a string that contains XML into something that can be displayed in a browser. To do so I am passing the string to the following function:\[code\]Function HTMLDecode(sText) Dim regEx Dim matches Dim match sText = Replace(sText, Chr(34), """) sText = Replace(sText, Chr(60), "<") sText = Replace(sText, Chr(62), ">") sText = Replace(sText, Chr(38), "&") sText = Replace(sText, Chr(32), "&nbsp;") Set regEx= New RegExp With regEx .Pattern = "&#(\d+);" 'Match html unicode escapes .Global = True End With Set matches = regEx.Execute(sText) 'Iterate over matches For Each match in matches 'For each unicode match, replace the whole match, with the ChrW of the digits. sText = Replace(sText, match.Value, ChrW(match.SubMatches(0))) Next HTMLDecode = sTextEnd Function\[/code\]However when I call, as follows:\[code\]response.write HTMLDecode(strResponse)\[/code\]the conversion happens but this is what I see in the browser:\[code\] <?xml version="1.0"? > \[/code\]rather than\[code\]<xml version="1.0"? >\[/code\]Happens in IE, FF & Chrome so I guess it must be my code - any ideas?
 
Back
Top