B2022-052: Division symbol converted to an X in table (also occurs in step text)

This commit is contained in:
Kathy Ruffing 2022-05-19 12:56:13 +00:00
parent d2501a0662
commit 564a75dcc1

View File

@ -129,12 +129,27 @@ namespace Volian.Base.Library
// convert \'a9 to \u169? this is for the copyright symbol. RTF converts the unicode character to \'a9
rtnStr = rtnStr.Replace(@"\'a9",@"\u169?");
// B2021-039: paste of the greek symbols was not working correctly, RTF was converting unicode, similar to above
for (int i = 0; i < 26; i++)
// B2022-052: Division symbol converted to an x, caused by fix B2021-039. The code below was translating the division
// symbol but it should only be translated if the character's font is Greek or Baltic. Unfortunately this is not
// a complete solution since it converts characters it shouldn't, for example, using the following steps: all
// of Proms symbols are entered into a step; a ctrl-a/ctrl-c is used to copy these and then ctrl-v to paste
// into another new step. The paste (from the underlying richtextbox) causes some characters to be in plain
// arial font, and others to be in arial with Greek flag. Some character codes exist in each font, for example f7.
// The code below does not look into what font is used, just converts the character. Since any kind of font
// can occur during paste, if from an external program, a message will be given stating that a symbol may be incorrect
// because an unsupported font was pasted. It was felt that this was sufficient based on estimate of fix versus chance of
// occurrence.
if (str.ToUpper().Contains("GREEK") || str.ToUpper().Contains("BALTIC"))
{
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xc0 + i) // upper case Greek
, string.Format("\\u{0}?", 912 + i));
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xe0 + i) // lower case Greek
, string.Format("\\u{0}?", 944 + i));
System.Windows.Forms.MessageBox.Show("Pasted text may use an unsupported font so some characters may not paste correctly and may require delete/reenter of character from within Proms.",
"Paste Font Issue", System.Windows.Forms.MessageBoxButtons.OK);
for (int i = 0; i < 26; i++)
{
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xc0 + i) // upper case Greek
, string.Format("\\u{0}?", 912 + i));
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xe0 + i) // lower case Greek
, string.Format("\\u{0}?", 944 + i));
}
}
return rtnStr;
}