Highlighted

Sourceedit converting specialchar to HTML entity code

Avatar

Avatar

krishnan2376223

Avatar

krishnan2376223

krishnan2376223

06-02-2019

Hi Everyone,

Issue I have is - In classic UI dialog with sourcedit option, when we write some content which have specialchars in it, example here Careers's apostrophe ( ' ), after edit and click Ok (on the dialog), and again go back and edit the dialog, under sourceedit it shows as careers's. This entity code is only display on sourceedit, but on the actual html page, it is good. Issue is backend it stores with entity code in it. Also tested other special character's, only special character having issue is for: & (ampersand) quotation (") Apostrophe('), &nbsp. Attached editconfig and dialog.xml. Please help me resolving this issue. Thanks in Advance !

AEM version - 6.3.

Thanks & Regards,

-Krishna.

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"

          cq:actions="[text: Rich Text,-,edit,-,copymove,-,delete,-,insert]"

          cq:dialogMode="floating"

          cq:disableTargeting="{Boolean}true"

          cq:emptyText="Drag components or assets here"

          cq:inherit="{Boolean}false"

          cq:layout="editbar"

          jcr:primaryType="cq:EditConfig">

    <cq:inplaceEditing

            jcr:primaryType="cq:InplaceEditingConfig"

            active="{Boolean}true"

            configPath="../../dialog/items/tabs/items/RichText/items/text

            editorType="text">

        <config jcr:primaryType="nt:unstructured">

            <rtePlugins jcr:primaryType="nt:unstructured">

                <subsuperscript

                        jcr:primaryType="nt:unstructured"

                        features="*"/>

                <paraformat

                        jcr:primaryType="nt:unstructured"

                        features="*">

                    <paraformat jcr:primaryType="nt:unstructured">

                        <p

                                jcr:primaryType="nt:unstructured"

                                name="Paragraph"

                                tag="p"/>

                        <h1

                                jcr:primaryType="nt:unstructured"

                                name="Header 1"

                                tag="h1"/>

                        <h2

                                jcr:primaryType="nt:unstructured"

                                name="Header 2"

                                tag="h2"/>

                        <h3

                                jcr:primaryType="nt:unstructured"

                                name="Header 3"

                                tag="h3"/>

                        <h4

                                jcr:primaryType="nt:unstructured"

                                name="Header 4"

                                tag="h4"/>

                        <h5

                                jcr:primaryType="nt:unstructured"

                                name="Header 5"

                                tag="h5"/>

                        <h6

                                jcr:primaryType="nt:unstructured"

                                name="Header 6"

                                tag="h6"/>

                        <span

                                jcr:primaryType="nt:unstructured"

                                name="Span"

                                tag="span"/>

                        <em

                                jcr:primaryType="nt:unstructured"

                                name="EM"

                                tag="em"/>

                        <hr

                                jcr:primaryType="nt:unstructured"

                                name="Horizontal Line"

                                tag="hr"/>

                    </paraformat>

                </paraformat>

                <misctools

                        jcr:primaryType="nt:unstructured"

                        features="*">

                    <specialCharsConfig jcr:primaryType="nt:unstructured">

                        <chars jcr:primaryType="nt:unstructured">

                            <copyright

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#169;"/>

                            <trademark

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#8482;"/>

                            <registered

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#174;"/>

                            <emDash

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#8212;"/>

                            <pound

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#163;"/>

                            <nbsp

                                    jcr:primaryType="nt:unstructured"

                                    entity="&amp;#160;"/>

                        </chars>

                    </specialCharsConfig>

                </misctools>

                <links jcr:primaryType="nt:unstructured">

                    <linkDialogConfig

                            jcr:primaryType="nt:unstructured"

                            height="{Long}316">

                        <linkAttributes jcr:primaryType="cq:WidgetCollection">

                            <linkAdvanced

                                    jcr:primaryType="cq:Widget"

                                    collapsed="{Boolean}true"

                                    collapsible="{Boolean}true"

                                    inputValue="advanced"

                                    name="./linkdialog/cq:adhocLinkTrackingTab"

                                    title="Link tracking"

                                    xtype="dialogfieldset">

                                <items jcr:primaryType="cq:WidgetCollection">

                                    <enable

                                            jcr:primaryType="nt:unstructured"

                                            attribute="enabletracking"

                                            fieldDescription="override analytics framework settings"

                                            fieldLabel="Custom link tracking"

                                            name="./linkdialog/cq:adhocLinkTrackingEnableTracking"

                                            xtype="checkbox">

                                        <listeners

                                                jcr:primaryType="nt:unstructured"

                                                check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>

                                    </enable>

                                    <events

                                            jcr:primaryType="nt:unstructured"

                                            attribute="adhocevents"

                                            fieldDescription="e.g.: event2, event7"

                                            fieldLabel="Include SiteCatalyst events"

                                            name="./linkdialog/cq:adhocLinkTrackingEvents"

                                            xtype="textfield"/>

                                    <evars

                                            jcr:primaryType="nt:unstructured"

                                            attribute="adhocevars"

                                            fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"

                                            fieldLabel="Include SiteCatalyst variables"

                                            name="./linkdialog/cq:adhocLinkTrackingEvars"

                                            xtype="textfield"/>

                                </items>

                            </linkAdvanced>

                        </linkAttributes>

                    </linkDialogConfig>

                </links>

                <edit

                        jcr:primaryType="nt:unstructured"

                        defaultPasteMode="plaintext"

                        stripHtmlTags="{Boolean}true"/>

                <spellcheck

                        jcr:primaryType="nt:unstructured"

                        features="*"/>

                <findreplace

                        jcr:primaryType="nt:unstructured"

                        features="*"/>

                <styles

                        jcr:primaryType="nt:unstructured"

                        features="*">

                    <styles jcr:primaryType="cq:WidgetCollection">

                        <rte-cta

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-cta"

                                text="Link within copy"/>

                        <rte-cta-outbound

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-cta-outbound"

                                text="Link Standalone"/>

                        <rte-primary

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-primary"

                                text="Primary button (Yellow Highlight)"/>

                        <rte-secondary

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-secondary"

                                text="Secondary button to internal link (Blue Highlight)"/>

                        <rte-secondary-outbound

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-secondary-outbound"

                                text="Secondary button to external link (Blue Highlight)"/>

                        <rte-tertiary

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-tertiary"

                                text="View More button"/>

                        <rte-download

                                jcr:primaryType="nt:unstructured"

                                cssName="rte-download"

                                text="Download link (w/cloud icon)"/>

                        <spec-sheet-caption

                                jcr:primaryType="nt:unstructured"

                                cssName="spec-sheet-caption"

                                text="Spec Sheet Caption"/>

                        <remove-bottom-margin

                                jcr:primaryType="nt:unstructured"

                                cssName="remove-bottom-margin"

                                text="Remove Bottom Margin"/>

                    </styles>

                </styles>

            </rtePlugins>

        </config>

    </cq:inplaceEditing>

</jcr:root>

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"

    jcr:primaryType="cq:Dialog"

    activeTab="0"

    allowBlank="{Boolean}false"

    disabled="{Boolean}false"

    height="700"

    hideLabel="{Boolean}false"

    title="Rich Text"

    width="800"

    xtype="dialog">

    <items jcr:primaryType="cq:WidgetCollection">

        <tabs jcr:primaryType="cq:TabPanel">

            <items jcr:primaryType="cq:WidgetCollection">

                <RichText

                    jcr:primaryType="cq:Widget"

                    title="Rich Text">

                            <items jcr:primaryType="cq:WidgetCollection">

                                <text

                                    jcr:primaryType="cq:Widget"

                                    allowBlank="{Boolean}true"

                                    disabled="{Boolean}false"

                                    height="500"

                                    hideLabel="{Boolean}true"

                                    removeSingleParagraphContainer="{Boolean}true"

                                    singleParagraphContainerReplacement="p"

                                    name="./text"

                                    externalStyleSheets="[/components/content/rte/less/rte.less]"

                                    xtype="richtext">

                                    <rtePlugins jcr:primaryType="nt:unstructured">

                                        <edit

                                            jcr:primaryType="nt:unstructured"

                                            features="[cut,copy,paste-default,paste-plaintext,paste-wordhtml]"/>

                                        <links

                                            jcr:primaryType="nt:unstructured"

                                            features="[modifylink,unlink,anchor]"/>

                                        <misctools

                                            jcr:primaryType="nt:unstructured"

                                            features="[specialchars,sourceedit]"/>

                                        <paraformat

                                            jcr:primaryType="nt:unstructured"

                                            features="*">

                                            <formats jcr:primaryType="cq:WidgetCollection">

                                                <format0

                                                    jcr:primaryType="nt:unstructured"

                                                    description="Paragraph"

                                                    tag="p"/>

                                                <format1

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H1 Page Title"

                                                    tag="h1"/>

                                                <format2

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H2 Section Heading"

                                                    tag="h2"/>

                                                <format3

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H3 Sub-Heading"

                                                    tag="h3"/>

                                                <format4

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H4 Sub-Text"

                                                    tag="h4"/>

                                                <format5

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H5 Orange Sub-Heading"

                                                    tag="h5"/>

                                                <format6

                                                    jcr:primaryType="nt:unstructured"

                                                    description="H6 Sub-Section Heading"

                                                    tag="h6"/>

                                                <format7

                                                    jcr:primaryType="nt:unstructured"

                                                    description="Span"

                                                    tag="span"/>

                                                <format8

                                                    jcr:primaryType="nt:unstructured"

                                                    description="EM"

                                                    tag="em"/>

                                                <format9

                                                    jcr:primaryType="nt:unstructured"

                                                    description="Horizontal Line"

                                                    tag="hr"/>

                                            </formats>

                                        </paraformat>

                                        <styles

                                            jcr:primaryType="nt:unstructured"

                                            features="*">

                                            <styles jcr:primaryType="cq:WidgetCollection">

                                                <style0

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-cta"

                                                    text="Link within copy"/>

                                                <style1

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-cta-outbound"

                                                    text="Link Standalone"/>

                                                <style2

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-primary"

                                                    text="Primary button (Yellow Highlight)"/>

                                                <style3

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-secondary"

                                                    text="Secondary button to internal link (Blue Highlight)"/>

                                                <style4

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-secondary-outbound"

                                                    text="Secondary button to external link (Blue Highlight)"/>

                                                <style5

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-tertiary"

                                                    text="View More button"/>

                                                <style6

                                                    jcr:primaryType="nt:unstructured"

                                                    cssName="rte-download"

                                                    text="Download link (w/cloud icon)"/>

                                                <style7

                                                        jcr:primaryType="nt:unstructured"

                                                        cssName="spec-sheet-caption"

                                                        text="Spec Sheet Caption"/>

                                                <style8

                                                        jcr:primaryType="nt:unstructured"

                                                        cssName="remove-bottom-margin"

                                                        text="Remove Bottom Margin"/>

                                            </styles>

                                        </styles>

                                        <subsuperscript

                                            jcr:primaryType="nt:unstructured"

                                            features="[subscript,superscript]"/>

                                    </rtePlugins>

                                </text>

                            </items>

                </RichText>

                <Borders

                    jcr:primaryType="cq:Widget"

                    title="Borders">

                    <items jcr:primaryType="cq:WidgetCollection">

                        <borderColor

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Border Color"

                            hideLabel="{Boolean}false"

                            name="./borderColor"

                            type="select"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text="Black"

                                    value="#000"/>

                                <option1

                                    jcr:primaryType="nt:unstructured"

                                    text="Gray"

                                    value="#5d656b"/>

                                <option2

                                    jcr:primaryType="nt:unstructured"

                                    text="Light Gray"

                                    value="#a6adb2"/>

                                <option3

                                    jcr:primaryType="nt:unstructured"

                                    text="Extra Light Gray"

                                    value="#e5e8e8"/>

                                <option4

                                    jcr:primaryType="nt:unstructured"

                                    text="White"

                                    value="#fff"/>

                            </options>

                        </borderColor>

                        <borderWidth

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Border Thickness"

                            hideLabel="{Boolean}false"

                            name="./borderWidth"

                            type="select"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text="1 pixel"

                                    value="1px"/>

                                <option1

                                    jcr:primaryType="nt:unstructured"

                                    text="2 pixels"

                                    value="2px"/>

                                <option2

                                    jcr:primaryType="nt:unstructured"

                                    text="3 pixels"

                                    value="3px"/>

                            </options>

                        </borderWidth>

                        <borderTop

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Top Border"

                            hideLabel="{Boolean}false"

                            name="./borderTop"

                            type="checkbox"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text=""

                                    value="true"/>

                            </options>

                        </borderTop>

                        <borderRight

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Right Border"

                            hideLabel="{Boolean}false"

                            name="./borderRight"

                            type="checkbox"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text=""

                                    value="true"/>

                            </options>

                        </borderRight>

                        <borderBottom

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Bottom Border"

                            hideLabel="{Boolean}false"

                            name="./borderBottom"

                            type="checkbox"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text=""

                                    value="true"/>

                            </options>

                        </borderBottom>

                        <borderLeft

                            jcr:primaryType="cq:Widget"

                            allowBlank="{Boolean}true"

                            disabled="{Boolean}false"

                            fieldLabel="Left Border"

                            hideLabel="{Boolean}false"

                            name="./borderLeft"

                            type="checkbox"

                            xtype="selection">

                            <options jcr:primaryType="cq:WidgetCollection">

                                <option0

                                    jcr:primaryType="nt:unstructured"

                                    text=""

                                    value="true"/>

                            </options>

                        </borderLeft>

                    </items>

                </Borders>

            </items>

        </tabs>

    </items>

</jcr:root>

Replies

Highlighted

Avatar

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281
Gaurav-Behl
MVP

12-02-2019

Do you mean to say that backend code has issues with character conversions?

Use encode/escape while saving and decode/unescape while retrieving the content. Would that solve the issue?