|
Write a class to replace special characters
Write to the database and call HTMLEncode, and output to call Htmldecode
Public Shared Function HTMLEncode(ByVal fString As System.Object) As String
If Not IsDBNull(fString) Then
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, "'", "''")
fString = Replace(fString, "", " ")
fString = Replace(fString, Chr(13), "")
fString = Replace(fString, Chr(10), "<BR>")
Return fString
Else
Return ""
End If
End Function
Public Shared Function Htmldecode(ByVal fString As System.Object) As String
If Not IsDBNull(fString) Then
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, " ", "")
fString = Replace(fString, "<BR>", Chr(10))
Return fString
Else
Return ""
End If
End Function |
|