Monday, August 29, 2011 11:15:00 AM
I had to escape the text inside of the styling generated by AJAX HTMLEditor that was getting displayed by qTip. If I did not escape the data it would break the jQuery code if there were apostrophies or any other special characters. There may be some bugs here...
private string EscapeData(string data)
{
int a,b,last;
string r=string.Empty;
a = 0;
last = 0;
do
{
a = data.IndexOf('<', a);
if (a == -1)
{
if (string.IsNullOrEmpty(r))
return System.Security.SecurityElement.Escape(data);
else
return r + System.Security.SecurityElement.Escape(data.Substring(last));
}
b = data.IndexOf('>', a);
r += System.Security.SecurityElement.Escape(data.Substring(last, a - last)) + data.Substring(a, b - a + 1);
last = b+1;
}while(true);
}