|
发表于 2020-6-17 10:15:01
|
显示全部楼层
写一类进行特殊字符的替换
写入数据库调用HTMLEncode,输出调用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 |
|