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



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

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.