Advertisement
ivandrofly

FixUnicodeChars

Jan 19th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1.         internal static string FixUnicodeChars(string text)
  2.         {
  3.             const string defHyphen = "-"; // - Hyphen-minus (\u002D) (default ansii)
  4.             const string defColon = ":";
  5.  
  6.             // Hyphens
  7.             text = text.Replace("\u2043", defHyphen); // ⁃ Hyphen bullet (\u2043)
  8.             text = text.Replace("\u2010", defHyphen); // ‐ Hyphen (\u2010)
  9.             text = text.Replace("\u2012", defHyphen); // ‒ Figure dash (\u2012)
  10.             text = text.Replace("\u2013", defHyphen); // – En dash (\u2013)
  11.             text = text.Replace("\u2014", defHyphen); // — Em dash (\u2014)
  12.             text = text.Replace("\u2015", defHyphen); // ― Horizontal bar (\u2015)
  13.  
  14.             // Colons:
  15.             text = text.Replace("\u02F8", defColon); // ˸ \u02F8
  16.             text = text.Replace("\u003A", defColon); // : \u003A
  17.             return text;
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement