In Summernote Text not displayed, possibly mistaken for html

A1WEBSITEPRO QuestionsCategory: QuestionsIn Summernote Text not displayed, possibly mistaken for html
Sam asked 1 year ago

Wrong text is displayed, example below in steps to reproduce.

steps to reproduce (Add more if necessary):

var emailText='<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
    xmlns="http://www.w3.org/TR/REC-html40">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)" />
</head>

<body link="#0563C1" vlink="#954F72" style="word-wrap:break-word" oncontextmenu="return false;">
    <div class="WordSection1">
        <p class="MsoNormal">Something is written here maybe an XML element
            maybe some random text that we do not want interpreted as html, for instance: 4v2UK<tR*Q<o:p>
                because, what comes instead is: 4v2UK.<o:p></o:p>
        </p>
    </div>
</body>
</html>'

1.$(#summernote).summernote(‘code’, emailText);

Text displayed: ‘…for instance: 4v2UK….’. Should be ‘for instance: 4v2UK<tR*Q….’.

What is your Operating System, Browser and Version and Summernote Version you are using:

  1. Operating System:
    [ X] Microsoft Windows

    Only cool people share!

  2. Browser and Version:
    [ ] Brave
    [X ] Chrome
    [ X] Edge
    [X ] Firefox
    [ ] Internet Explorer
    [ ] Opera
    [ ] Safari
    [ ] Other (Specify):

  3. Summernote Version, place an x inside the brackets:
    Super simple wysiwyg editor v0.8.18

In Summernote Text not displayed, possibly mistaken for html was last modified: March 2nd, 2023 by Sam
1 Answers
Best Answer
Maximus Mccullough Staff answered 1 year ago

If you’re using Summernote and the text you’ve entered isn’t displaying properly, it’s possible that the text is being mistaken for HTML code.
One way to check if this is the case is to open the HTML source code of the page and see if the text is being displayed as HTML tags. If this is the case, you’ll need to encode the text using HTML entities.
For example, if your text contains the less-than symbol (“<“), Summernote might interpret it as the start of an HTML tag. To fix this, you can replace “<” with “<“.
Alternatively, you can disable Summernote’s HTML interpretation by setting the “disableDragAndDrop” option to “true” in the Summernote configuration. This will prevent Summernote from trying to parse your text as HTML code.
If neither of these solutions work, it’s possible that there’s another issue causing the problem. You may need to provide more information or seek help from the Summernote community or support team.

Answer for In Summernote Text not displayed, possibly mistaken for html was last modified: March 2nd, 2023 by Maximus Mccullough