/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public string HTMLEncodeSpecialChars(string text) { foreach (char c in text){ if(c>127) // special chars sb.Append(String.Format("&#{0};",(int)c)); else sb.Append(c); } return sb.ToString(); }