[Modify] Add it
This commit is contained in:
parent
1c2472c9f3
commit
f8a70130e7
@ -155,6 +155,29 @@ namespace WebSocketSharp.Net
|
|||||||
return buff.ToString ();
|
return buff.ToString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string htmlEncode (string s)
|
||||||
|
{
|
||||||
|
var buff = new StringBuilder ();
|
||||||
|
|
||||||
|
foreach (var c in s) {
|
||||||
|
buff.Append (
|
||||||
|
c == '"'
|
||||||
|
? """
|
||||||
|
: c == '&'
|
||||||
|
? "&"
|
||||||
|
: c == '<'
|
||||||
|
? "<"
|
||||||
|
: c == '>'
|
||||||
|
? ">"
|
||||||
|
: c > 159
|
||||||
|
? String.Format ("&#{0};", (int) c)
|
||||||
|
: c.ToString ()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buff.ToString ();
|
||||||
|
}
|
||||||
|
|
||||||
private static void initEntities ()
|
private static void initEntities ()
|
||||||
{
|
{
|
||||||
// Build the dictionary of HTML entity references.
|
// Build the dictionary of HTML entity references.
|
||||||
|
Loading…
Reference in New Issue
Block a user