WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

Last modified 5 years ago

#4556 closed defect (bug) (duplicate)

Fancy quotes broken inside parentheses

Reported by: bglickstein Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.2
Component: General Keywords:
Focuses: Cc:

Description

If I put text in plain quotes inside of parentheses ("like this"), Wordpress mistranslates the quotes into curly quotes. I have a simple patch against wp-includes/formatting.php (tag 2.2.1, revision 5735) that should fix this. It makes open-parens (and open-brackets) "transparent" to left curly quotes, and close-parens (and close-brackets) "transparent" to right curly quotes.

Cheers,

  • Bob
Index: formatting.php
===================================================================
--- formatting.php	(revision 5772)
+++ formatting.php	(working copy)
@@ -20,8 +20,8 @@
 	$static_characters = array_merge(array('---', ' -- ', '--', 'xn–', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney); 
 	$static_replacements = array_merge(array('—', ' — ', '–', 'xn--', '…', '“', '’s', '”', ' ™'), $cockneyreplace);
 
-	$dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
-	$dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1“$2', '”$1', '’$1', '$1×$2');
+	$dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)([\[(]*)"(?!\s)/', '/"([\])]*)(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
+	$dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1$2“$3', '”$1$2', '’$1', '$1×$2');
 
 	for ( $i = 0; $i < $stop; $i++ ) {
  		$curl = $textarr[$i];

Change History (4)

comment:1 foolswisdom7 years ago

  • Milestone set to 2.4 (future)
  • Version set to 2.2

Hello Bob, Thank you for the bug report. What is the version of WordPress you discovered the problem in and the one that your fix is for? The actual behavior is that the quotes are translated into smart quotes, but the expected behavior is that they are not?

comment:2 in reply to: ↑ description Otto427 years ago

Replying to bglickstein:

If I put text in plain quotes inside of parentheses ("like this"), Wordpress mistranslates the quotes into curly quotes.

Define "mistranslates"? I believe this is expected behavior, it's supposed to translate them into "curly quotes". Why would you expect it not to do so when they are in parenths?

comment:3 bglickstein7 years ago

I have seen this problem in all versions of Wordpress since I started using it (v2.0) but only just now got around to doing something about it.

To be clearer, the problem is that the opening quote gets translated into a right double-quote when it should be translated into a left double-quote.

Cheers,

  • Bob

comment:4 mrmist5 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

There's just too many of these reports.

See also #7754 #4539 #3810 #4116 #1258

Note: See TracTickets for help on using tickets.