ASP
Here you can find some FREE usefull Classic ASP / VBScript code snippets, class modules, etc.
Function HTML2Text(String)String
Converts a HTML encoded String into plain text.
Example
<% Dim textValue textValue = HTML2Text("Smith & Son ©") ' This will return in plain text "Smith & Son ©" %> Source Code <%
Function HTML2Text(htmlData) Dim i, c, htmlChars htmlChars = Split(",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,"" & _ ",,,,&,,,,,,,,,,,,,,,,,,,,,,<,,>,,,,,,,,,,,,,,,,," & _ ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," & _ ",,,,,,,,,,,,,,,,,,,,,,, ,¡,¢,£,¤" & _ ",¥,¦,§,¨,©,ª,«,¬," & _ "­,®,¯,°,±,²,³,´," & _ "µ,¶,·,¸,¹,º,»,¼" & _ ",½,¾,¿,À,Á,Â,Ã" & _ ",Ä,Å,Æ,Ç,È,É,Ê," & _ "Ë,Ì,Í,Î,Ï,Ð,Ñ,Ò" & _ ",Ó,Ô,Õ,Ö,×,Ø,Ù," & _ "Ú,Û,Ü,Ý,Þ,ß,à," & _ "á,â,ã,ä,å,æ,ç," & _ "è,é,ê,ë,ì,í,î," & _ "ï,ð,ñ,ò,ó,ô,õ,ö" & _ ",÷,ø,ù,ú,û,ü,ý," & _ "þ,ÿ", ",") HTML2Text = htmlData For i = 0 To UBound(htmlChars) c = htmlChars(i) If c > "" Then If InStr(HTML2Text, c) > 0 Then HTML2Text = Replace(HTML2Text, c, Chr(i)) End If Next ReDim htmlChars(0): Erase htmlChars End Function %> |