[Modify] Add it

master
sta 7 years ago
parent b740ea771d
commit 0cd36dc615

@ -178,6 +178,29 @@ namespace WebSocketSharp.Net
return buff.ToString ();
}
private static string htmlEncode (string s, bool attribute)
{
var buff = new StringBuilder ();
foreach (var c in s) {
buff.Append (
c == '"'
? """
: c == '&'
? "&"
: c == '<'
? "&lt;"
: c == '>'
? "&gt;"
: !attribute && c > 159
? String.Format ("&#{0};", (int) c)
: c.ToString ()
);
}
return buff.ToString ();
}
private static void initEntities ()
{
// Build the dictionary of HTML entity references.

Loading…
Cancel
Save