2

So, some users have decided to paste word documents into the app I work on. As a result we have the likes of this â–¼ in the database, this should be a black downward triangle like this ▼

Now the app uses a .vbs file to get the data and display it to a classic asp page, the problem is, if I do a replace looking for â–¼ the vbs has already converted it to a ▼ and of course it never finds it, so i just end up with â–¼ being displayed asp page.

so even though i wrote this

strRet = replace(strRet, "â–¼", "▼")

when I debug it looks like this

strRet = replace(strRet, "▼", "▼")

Does anyone know how I can get vbs to look for the actual string of characters

  • take a look at this answer http://stackoverflow.com/questions/22259401/classic-asp-vbscript-replace-special-character-in-a-string-is-acting-strange – peter Jul 25 '16 at 08:29

1 Answers1

2

Use AscW() and ChrW() to build the target string for the Replace() call:

>> s = "â–¼"
>> WScript.Echo s, AscW(Mid(s, 1, 1)), AscW(Mid(s, 2, 1)), AscW(Mid(s, 3, 1))
>>
â–¼ 226 8211 188
>> WScript.Echo Replace(s, ChrW(226) & ChrW(8211) & ChrW(188), ChrW(9660))
>>
▼
>>
Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96