private static string EncodeValue(ref string text)
{
buffStr.Remove(0, buffStr.Length);
foreach (char c in text)
{
if (c == '\'')
buffStr.Append("'");
else if (c == '"')
buffStr.Append(""");
else if ((c <= 0x1f && c != 0x9 && c != 0x10 && c != 0x13) || c > 127)
buffStr.Append(string.Format("&#x{0:x};", (int)c));
else
buffStr.Append(c);
}
return buffStr.ToString();
}