diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 531d0e60..6f6285f0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -811,11 +811,26 @@ namespace VEPROMS.CSLA.Library /// /// B2017-121 Regular Express for all RTF tokens for Hyphens /// - private static Regex regHyphen = new Regex(@"(?", "\\\\"),@"\u8209?"); + // B2017-196: Now replace plain '-' with unicode. Note that the hanging indent rtf command had 'fi-' in it, so couldn't do it in regex above: + int indx = rtbString.IndexOf('-'); + while (indx > -1) + { + if (indx > 2) + { + if (rtbString[indx - 1] != 'i' || rtbString[indx - 2] != 'f' || rtbString[indx - 3] != '\\') + { + rtbString = rtbString.Remove(indx, 1); + rtbString = rtbString.Insert(indx, @"\u8209?"); + } + if (indx + 1 > rtbString.Length) indx = -1; + else indx = rtbString.IndexOf('-', indx+1); + } + } return Save(rtbString); } public bool Save(string modtext)