Public Function GetHTMLEncoding(ByVal Input As String) As String
Dim p As Xml.XmlDocument = New Xml.XmlDocument
With p.CreateTextNode(Input)
Return (.OuterXml)
End With
End Function
Public Function GetHTMLDecoding(ByVal Input As String) As String
Dim p As Xml.XmlDocument = New Xml.XmlDocument
p.LoadXml("<p>" & Input & "</p>")
Return p.SelectSingleNode("p").InnerText
End Function
'usage examples..
MsgBox(GetHTMLEncoding("prashant& owns& it&"))
MsgBox(GetHTMLDecoding("prashant & owned & it! &"))