[wp-trac] [WordPress Trac] #31156: TinyMCE doesn't always clean up and remove the non-breaking spaces it's creating
WordPress Trac
noreply at wordpress.org
Wed Jan 28 13:25:15 UTC 2015
#31156: TinyMCE doesn't always clean up and remove the non-breaking spaces it's
creating
-------------------------------+-----------------------------
Reporter: Denis-de-Bernardy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: 4.1
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
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
[https://wordpress.org/support/topic/the_content-is-inserting-weird-
0xc2a0-characters?replies=7#post-438700 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31156>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list