From 4962c35ce6449790899d130e742140422c63aecf Mon Sep 17 00:00:00 2001 From: John T Maxwell III Date: Wed, 5 Jun 2024 12:18:14 -0700 Subject: [PATCH] Fix LT-10373: Try a Word crashes for double quote and angle bracket (#75) * Generalize Andy's fix to include angle bracket and other XML characters --------- Co-authored-by: Andrew Black Co-authored-by: Jason Naylor --- Src/LexText/ParserUI/TryAWordDlg.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Src/LexText/ParserUI/TryAWordDlg.cs b/Src/LexText/ParserUI/TryAWordDlg.cs index 38e976a3ee..f158059a0c 100644 --- a/Src/LexText/ParserUI/TryAWordDlg.cs +++ b/Src/LexText/ParserUI/TryAWordDlg.cs @@ -410,6 +410,8 @@ private void m_tryItButton_Click(object sender, EventArgs e) // Display a "processing" message (and include info on how to improve the results) var uri = new Uri(Path.Combine(TransformPath, "WhileTracing.htm")); m_htmlControl.URL = uri.AbsoluteUri; + sWord = new System.Xml.Linq.XText(sWord).ToString(); // LT-10373 XML special characters cause a crash; change it so HTML/XML works + sWord = sWord.Replace("\"", """); // LT-10373 same for double quote sWord = sWord.Replace(' ', '.'); // LT-7334 to allow for phrases; do this at the last minute m_parserListener.Connection.TryAWordDialogIsRunning = true; // make sure this is set properly m_tryAWordResult = m_parserListener.Connection.BeginTryAWord(sWord, DoTrace, selectedTraceMorphs);