[Modify] Add it
This commit is contained in:
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 == '<'
|
||||
? "<"
|
||||
: c == '>'
|
||||
? ">"
|
||||
: !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…
Reference in New Issue
Block a user