Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12012 closed Bug (invalid)

HTML Entities Problem with &lt; &gt; inside of the <code> segment

Reported by: scabro Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


I'm having a problem with the following block of code, which comes directly from database:

<pre data-pbcklang="html" data-pbcktabsize="4">
<code class="language-html ">&lt;p&gt;
    &lt;a href=&quot;#&quot;&gt;Test&lt;/a&gt;

when loaded into the ckeditor it gets converted to:

<pre data-pbcklang="html" data-pbcktabsize="4">


<p><code class="language-html "><a href="#">Test</a> </code></p>

Any idea how to prevent this behavior?

Change History (4)

comment:1 Changed 10 years ago by Piotrek Koszuliński

Keywords: html entities code html brackets removed
Resolution: invalid
Status: newclosed
Version: 4.4.1

When loaded through the source mode it is not converted to the code below. It is converted when you set it in <textarea> without encoding it first. Note that the content of <textarea> must be encoded like in our samples. Check e.g.

comment:2 Changed 10 years ago by scabro

Not sure I understand. The code that's passed to the textarea is

<pre data-pbcklang="html" data-pbcktabsize="4">
<code class="language-html ">&lt;p&gt;
    &lt;a href=&quot;#&quot;&gt;Test&lt;/a&gt;

What else can I encode here?

comment:3 Changed 10 years ago by Piotrek Koszuliński

Exactly everything.

< should become &lt;


&lt; should become &amp;lt;

comment:4 Changed 10 years ago by scabro

Thanks - I've used htmlentities() and it seemed to do the trick.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy