/// <summary> /// Extension method to HTML encode any string characters with ASCII > 127 /// </summary> /// <param name="str">string to be encoded</param> /// <returns>Encoded string</returns> public static string ToHtml(this string str) { return string.Join("", str.ToCharArray().Select(c => (int)c > 127 ? "&#" + (int)c + ";" : c.ToString()).ToArray()); }
Powered by: newtelligence dasBlog 2.3.9074.18820
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, © Copyright 2010
E-mail