Make WordPress Core

Opened 8 years ago

Last modified 6 years ago

#38713 new defect (bug)

Shortcodes and utf-8 no-break whitespace (\xc2\xa0)

Reported by: mazursv's profile mazursv Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Shortcodes Keywords:
Focuses: Cc:

Description

Recently I encountered a problem with one of my posts where Wordpress failed to process some of the shortcodes. After hours of digging I found that one shortcode contains no-breaking space as separator between shortcode name and parameters.

[myshortcode\xc2\xa0param="...

Seems like somebody used external editor to edit post content and then pasted it into wp's editor.

I used following quick fix to permit this problem in future :

add_filter( 'the_content', function( $text ) {
	return str_replace( "\xc2\xa0", " ", $text );
}, 0, 1);

I think, it's not very good approach. Thus the question to core developers to fix this in shortcode parsing functions.

Change History (1)

Note: See TracTickets for help on using tickets.