Main Software ActiveX ASP Source Downloads Android Contact
ASP

Here you can find some FREE usefull Classic ASP / VBScript code snippets, class modules, etc.
I use then myself on most of my projects, so you can rest assured they were optimized over time and are very reliable.
You can use them on your personal or commercial projects.
If you find them usefull to you, please make a donation (nomatter how small) to help me keep this content online for free.


Encode and Decode String File IO Misc
Base-64
HTML2Text
Recaptcha
SHA-1
Text2HTML
Escape
FileNameIn
FileSizeDesc
Format
RemoveTags
BinReadFile
CreateFolder
FileDateTime
FileExists
FileLen
FolderExists
GetFiles
GetFolders
ReadFile
IsValidEmail
SendCDOMail
ScanVar
Function Text2HTML(String)String Converts plain text into safe HTML for proper display.
Example
<%
response.write Text2HTML("Smith & Son ©")
' This will return the HTML string "Smith&nbsp;&amp;&nbsp;Son&nbsp;&copy;"
%>


Source Code
<%
Function Text2HTML(strData)
Dim i, c, h, res, htmlChars
htmlChars = Split(",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,&nbsp;,,&quot;" & _
   ",,,,&amp;,,,,,,,,,,,,,,,,,,,,,,&lt;,,&gt;,,,,,,,,,,,,,,,,," & _
   ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," & _
   ",,,,,,,,,,,,,,,,,,,,,,,&nbsp;,&iexcl;,&cent;,&pound;,&curren;" & _
   ",&yen;,&brvbar;,&sect;,&uml;,&copy;,&ordf;,&laquo;,&not;," & _
   "&shy;,&reg;,&macr;,&deg;,&plusmn;,&sup2;,&sup3;,&acute;," & _
   "&micro;,&para;,&middot;,&cedil;,&sup1;,&ordm;,&raquo;,&frac14;" & _
   ",&frac12;,&frac34;,&iquest;,&Agrave;,&Aacute;,&Acirc;,&Atilde;" & _
   ",&Auml;,&Aring;,&AElig;,&Ccedil;,&Egrave;,&Eacute;,&Ecirc;," & _
   "&Euml;,&Igrave;,&Iacute;,&Icirc;,&Iuml;,&ETH;,&Ntilde;,&Ograve;" & _
   ",&Oacute;,&Ocirc;,&Otilde;,&Ouml;,&times;,&Oslash;,&Ugrave;," & _
   "&Uacute;,&Ucirc;,&Uuml;,&Yacute;,&THORN;,&szlig;,&agrave;," & _
   "&aacute;,&acirc;,&atilde;,&auml;,&aring;,&aelig;,&ccedil;," & _
   "&egrave;,&eacute;,&ecirc;,&euml;,&igrave;,&iacute,&icirc;," & _
   "&iuml;,&eth;,&ntilde;,&ograve;,&oacute;,&ocirc;,&otilde;,&ouml;" & _
   ",&divide;,&oslash;,&ugrave;,&uacute;,&ucirc;,&uuml;,&yacute;," & _
   "&thorn;,&yuml;", ",")
ReDim res(Len(strData) - 1)
For i = 1 To Len(strData)
   c = Mid(strData, i, 1)
   h = htmlChars(Asc(c))
   If h = "" Then res(i - 1) = c Else res(i - 1) = h
Next
Text2HTML = Join(res, "")
ReDim res(0): ReDim htmlChars(0): Erase res, htmlChars
End Function
%>