Opened 10 years ago
Closed 6 years ago
#31156 closed defect (bug) (duplicate)
TinyMCE doesn't always clean up and remove the non-breaking spaces it's creating
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | TinyMCE | Keywords: | |
Focuses: | Cc: |
Description
TinyMCE occasionally creates two or more invisible non-breaking spaces (encoding 0xA0
or, in my case on OS X Yosemite using Safari 8.0.2, 0xC2A0
), but then doesn't clean them up properly.
The rational for inserting them at all seems sane. For instance, the 0xC2A0
0xC2A0
character sequence appears when you inadvertently type space twice as you type. If you delete one of the two spaces, they get replaced to a single space as needed.
A problem occurs, however, when you copy and paste, placing the cursor between two unbreaking space characters and hitting space will yield unexpected results and incorrectly keep the character around.
TinyMCE content: foo bar baz > select replace(post_content, char(0xC2), ' ') from wp_posts where id = 11; +----------------------------------------+ | replace(post_content, char(0xC2), ' ') | +----------------------------------------+ | foo ? ?bar baz | +----------------------------------------+ 1 row in set (0.00 sec)
Select bar and *one* of the spaces before it, and paste the string test.
TinyMCE content: foo test baz MariaDB [mesoconcepts]> select replace(post_content, char(0xC2), ' ') from wp_posts where id = 11; +----------------------------------------+ | replace(post_content, char(0xC2), ' ') | +----------------------------------------+ | foo test ?baz | +----------------------------------------+ 1 row in set (0.00 sec)
It seems like an old unreported bug, too. See for instance this reply that references the problem 8 years ago.
I imagine my own site isn't the only one with non-breaking space clutter around. In addition to reporting the bug upstream to MoxieCode (I you've the relevant contacts to do so), I'd like to suggest that we actually try to salvage polluted posts during the next upgrade.
Related: #31157