Posted By

elightbo on 10/02/08


Tagged

character text function Microsoft


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

benrudolph


Strip nasty Microsoft tags


 / Published in: ASP
 

URL: http://www.ralpharama.co.uk/item.php?itemid=268&page=ASP+%2F+VB+Script+Smart-tag+stripper

  1. Function fixMyEffingText(strText)
  2. strText = Replace(strText,"Source","Dest")
  3. ' Smart Open Single Quote
  4. strText = Replace(strText,Chr(145),"'")
  5. ' Smart Close Single Quote
  6. strText = Replace(strText,Chr(146),"'")
  7. ' Smart Open Double Quote
  8. strText = Replace(strText,Chr(147),Chr(34))
  9. ' Smart Close Double Quote
  10. strText = Replace(strText,Chr(148),Chr(34))
  11. ' Smart Short Hyphen
  12. strText = Replace(strText,Chr(150),"-")
  13. ' Smart Long Hyphen
  14. strText = Replace(strText,Chr(151),"--")
  15. ' Odd Apostrophe Top-Right
  16. strText = Replace(strText,Chr(180),"'")
  17. ' Cidilla without a letter / Odd Comma
  18. strText = Replace(strText,Chr(184),",")
  19. ' Bullet
  20. strText = Replace(strText,Chr(149),"ยท")
  21. ' Smart Dot dot dot
  22. strText = Replace(strText,Chr(133),"...")
  23. ' Bottom Quote
  24. strText = Replace(strText,Chr(132),Chr(34))
  25. ' Approx symbol at top
  26. strText = Replace(strText,Chr(152),"~")
  27. ' Approx symbol (long)
  28. strText = Replace(strText,Chr(126),"~")
  29. ' Line Feed
  30. strText = Replace(strText,Chr(10),"<br>")
  31. ' CR
  32. strText = Replace(strText,Chr(21),"<br>")
  33. ' Do all Greater than Char 128
  34. For i = 129 to 255
  35. c = "&#" & i & ";"
  36. strText = Replace(strText,Chr(i),c)
  37. Next
  38. fixMyEffingText = strText
  39. End Function

Report this snippet  

You need to login to post a comment.