function htmlencode(str)
dim result
dim l
if isNULL(str) then
htmlencode=""
exit function
End if
l=len(str)
result=""
dim i
for i = to l
select case mid(stri)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr()
result=result+"""
case "&"
result=result+"&"
case chr()
result=result+" "
if i+<=l and i> then
if mid(stri+)=chr() or mid(stri+)=chr() or mid(stri)=chr() or mid(stri)=chr() then
result=result+" "
else
result=result+" "
End if
else
result=result+" "
End if
case chr()
result=result+" "
case else
result=result+mid(stri)
End select
next
htmlencode=result
End function
}