Function htmlencode (t0) If Len (t0) <0 or isarray (t0) Then exit functiont0 = trim (t0) t0 = Re (T0, CHR (9 ),"") '"tab" T0 = Re (T0, CHR (13), "")' press ENTER T0 = Re (T0, CHR (22), "") t0 = Re (T0, CHR (38), "&") '"&" T0 = Re (T0, CHR (32), "")' "" T0 = Re (T0, CHR (34), "") '"" T0 = Re (T0, CHR (37), "%")' "%" T0 = Re (T0, CHR (39), "'")' "" T0 = Re (T0, CHR (42), "*") '"*" T0 = Re (T0, CHR (43), "+") '"+" T0 = Re (T0, CHR (44), ",")' "," T0 = Re (T0, CHR (45) & CHR (45), "--") '"--" T0 = Re (T0, CHR (92 ),"\") '"\" T0 = Re (T0, CHR (40), "(")' "(" T0 = Re (T0, CHR (41 ),")") '")" T0 = Re (T0, CHR (60), "<")' "<" T0 = Re (T0, CHR (62), "> ") '">" T0 = Re (T0, CHR (123), "{")' "{" T0 = Re (T0, CHR (125 ),"}") '} "T0 = Re (T0, CHR (59),"; ")';" T0 = Re (T0, CHR (10) & CHR (10 ), CHR (10) 'replaces line feed T0 = Re (T0, CHR (10), "<br>")' line feed T0 = replacetext (T0, "([& #]) ([a-z0-9] *);", "$1 $2;") if lyq_badtext <> "then T0 = replacetext (T0, "(" & lyq_badtext & ")", string (LEN ("& $1 &"), "*") 'filter katakana (Japanese characters) [\ u30a0-\ u30ff] If is_ SQL thent0 = escape (t0) t0 = replacetext (T0, "% u30 ([A-F] [0-f])", "& # x30 $1;") t0 = Unescape (t0) end ifhtmlencode = t0end Function
Function Re(t0,t1,t2)IF Isnull(t2) Then t2=""Re=Replace(t0,t1,t2)End Function
Function ReplaceText(t0,t1,t2)Set regEx=New RegExpregEx.Pattern=t1regEx.IgnoreCase=TrueregEx.Global=TrueReplaceText=regEx.Replace(""&t0&"",""&t2&"")Set regEx=nothingEnd Function