CuteSoft Editor fails to encode ampersands when viewing XHTML property output - FIX
We've recently been having problems with the CuteSoft editor when viewing the Text property ampersands are correctly encoded as & however when viewing the XHTML property the ampersands are simply shown as "&".
We need to use the XHTML property as this resolves issues with the layout of the code, ensuring that the output is XHTML compliant for example ensuring tags are closed correctly in the right order.
However with the unencoded ampersands the output is NOT XHTML compliant.
We've investigated this further and found that the method being called internally is ConvertToXml() which has the following line of code
As a workaround to this to get both encoded ampersands and also have XHTML compliant formatting we can do the following
This temporarily moves the encoded ampersands from the text before calling the XHTML property, and then returns them afterwards. Solved.
We need to use the XHTML property as this resolves issues with the layout of the code, ensuring that the output is XHTML compliant for example ensuring tags are closed correctly in the right order.
However with the unencoded ampersands the output is NOT XHTML compliant.
We've investigated this further and found that the method being called internally is ConvertToXml() which has the following line of code
str1 = str1.Replace("&", "&");
As a workaround to this to get both encoded ampersands and also have XHTML compliant formatting we can do the following
Editor1.Text =
Editor1.Text.Replace("&", "[Temp_Amp_Replacement]");
string xml
= Editor1.XHTML.Replace("[Temp_Amp_Replacement]",
"&");
Editor1.Text =
Editor1.Text.Replace("[Temp_Amp_Replacement]",
"&");
This temporarily moves the encoded ampersands from the text before calling the XHTML property, and then returns them afterwards. Solved.
Comments
Post a Comment