[wp-trac] [WordPress Trac] #22692: Quotes Are Messing Up

WordPress Trac noreply at wordpress.org
Mon Apr 8 22:28:07 UTC 2013


#22692: Quotes Are Messing Up
------------------------------------------+------------------------------
 Reporter:  miqrogroove                   |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Formatting                    |     Version:  3.4.2
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |
------------------------------------------+------------------------------

Comment (by miqrogroove):

 {{{
 $text = "A sentence. \xC2\xA0\"A quote after 2 spaces.\"";

 $opening_quote = '“';
 $closing_quote = '”';

 $dynamic = array();
 $dynamic[ '/(\s|\A|[([{<])"(?!\s)/'    ] = '$1' . $opening_quote . '$2';
 $dynamic[ '/"(\s|\S|\Z)/'              ] = $closing_quote . '$1';

 $dynamic_characters = array_keys( $dynamic );
 $dynamic_replacements = array_values( $dynamic );

 echo preg_replace($dynamic_characters, $dynamic_replacements, $text);
 }}}

 The above test case produces bad output on my BlueHost account, but works
 perfectly on my home server.  Configurations are quite different; unsure
 the culprit.  Suspect mb string.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22692#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list