Special characters or trailing spaces are HTML-encoded in AI CKEditor selected text preview
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3540608. -->
Reported by: [sijumpk](https://www.drupal.org/user/389053)
Related to !1353 !1290 !1264 !821
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>
When entering text with special characters or trailing spaces in the CKEditor (e.g., "<code>pineapple > apple </code>"),<br>
the special characters or trailing spaces are displayed as encoded entities in selected text preview (e.g., <code>pineapple &gt; apple&nbsp;</code>)<br>
when using AI CKEditor options like <strong>Summarize</strong>. Attaching screenshots.
</p>
<h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<ol>
<li>Enable AI CKEditor integration in Drupal.</li>
<li>Open the CKEditor for any text field.</li>
<li>Enter text containing special characters and a trailing space, for example: <em>"pineapple > apple "</em>.</li>
<li>Use an AI CKEditor option like <strong>Summarize</strong>.</li>
<li>Observe that the "Selected text to summarize" displays encoded entities instead of the original characters.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Prevent unnecessary HTML entity encoding for special characters and trailing spaces while showing <em>Selected text to summarize</em> preview.</li>
</ul>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Implement fix in the AI CKEditor processing logic.</li>
</ul>
<h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3>
issue