Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#14259 closed defect (bug) (invalid)

ASCII encoded characters are decoded when switching between HTML & Visual editors

Reported by: Gnopps Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Editor Keywords:
Focuses: Cc:


If ASCII-codes instead of characters are entered in the HTML editor and then saved the resulting page is also stored with these codes. However, if the codes are entered first in the HTML editor and then you switch to Visual editor and back to HTML editor the codes have been decoded and instead their representative characters are shown and stored in the resulting code.


In HTML-editor enter

<a href="m&#97;ilto:&#97;&#64;&#98;&#46;&#99;&#111;&#109;?subject=" title="">&#65;&#66;</a>

and save. Show the page created and in its source you will see the ASCII-codes above have been saved just as they were entered.

Now with the codes visible switch to the Visual editor and then switch back to HTML editor. You will now see that the ASCII-codes are gone and instead you will see

<a href="mailto:a@b.com?subject=">AB</a>

The bug here is that the editor(s) transform the ASCII-codes instead of saving them as they are typed.

Change History (1)

#1 @azaozz
5 years ago

  • Keywords ASCII-codes Visual editor removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 3.0 deleted

This is the intended behavior. By default the Visual editor only stores the htmlspecialchars as entities. The HTML editor gives more control over this (but when the user doesn't have the "unfiltered_html" capability kses would filter many things anyways).

Please note that in contentEditable mode different browsers have different character encoding requirements/quirks/bugs etc. TinyMCE normalizes this and has several settings controlling the encoding in the output.

Note: See TracTickets for help on using tickets.