weird characters showing up in html
I have a project that gets input from an xml file that we extract information from select nodes.
One of the does we take the info and just output in a <pre> tag since it's already formated from source.
We started seeing all these B's in the output so I ran a loop through all the characters and display the ascii value to see what it is and this is what I get in return.
How I get value:
Code:
For x=1 To Len(str)
result = result & Mid(str, x, 1) & "(" & Asc(Mid(str, x, 1)) & ")"
Next
Result for the character in question:
В (-15712)
Any ideas how I can strip these out?
Thanks.
Re: weird characters showing up in html
Try:
Code:
str = Replace(str, ChrW(-15712), vbNullString)
BTW, your "weird" character appears to be a Korean character: 슠
Re: weird characters showing up in html
Thanks for the reply. That didn't work but did end up trying some regex and seems to work.
Code:
strPattern = "[^\x20-\x7E\t\f\n\r]"
strReplace = " "
outstr = RegExpReplace(outstr, strPattern, strReplace)
Function RegExpReplace(Str, Pattern, Replacement)
Set objRegExp = New RegExp
objRegExp.Pattern = Pattern
objRegExp.Global = True
objRegExp.IgnoreCase = True
RegExpReplace = objRegExp.Replace(Str, Replacement)
Set objRegExp = Nothing
End Function