[wp-trac] [WordPress Trac] #35022: WP allows Unicode 0x00a0 spaces in editor but shortcode parser can't handle them
WordPress Trac
noreply at wordpress.org
Thu Mar 17 21:37:27 UTC 2016
#35022: WP allows Unicode 0x00a0 spaces in editor but shortcode parser can't handle
them
--------------------------+-----------------------------
Reporter: steevithak | Owner:
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Future Release
Component: Shortcodes | Version: 4.4
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+-----------------------------
Comment (by steevithak):
Ok, first attempt at a patch is uploaded. To fix the parsing of shortcodes
with Unicode non-breaking spaces, I modified the regex currently in use by
replacing the list of ASCII whitespace chars (\x00-\x20) with the \s
whitespace match and then converting the regex to Unicode mode by adding
the 'u' modifier. In theory this means any legal white space character
ASCII or Unicode should now work.
To fix the problem with corrupted quote characters that causes the first
shortcode attribute to be dropped, I add a work around in which the
Unicode quote entity values are replaced with conventional ASCII quote
chars prior to running the shortcode attribute parser. This allowed a
simple one-line fix that doesn't require messing with the complex
attribute parsing regex. The downside is that this is really just a work-
around because I don't know where in WP the quote characters are being
corrupted. This one-line change could be reverted later if someone figures
out the real source of this problem.
Dislaimer: this works for me but hasn't been tested extensively. Hopefully
some core developers can take a look and make sure it doesn't break
anything.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35022#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list