Make WordPress Core

Opened 11 years ago

Closed 6 years ago

#1258 closed defect (bug) (duplicate)

Curly quotes mixups

Reported by: Denis de Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.2
Component: General Keywords:
Focuses: Cc:

Description (last modified by markjaquith)

I think there is a tiny problem in the wordpress text renduring:

when you use single quotes in the text, WP converts them to single fancy quotes. However, some quotes are transformed in the wrong direction.

e.g. if you type: 'products', 'services', you get ‘products’, ’services’ rather than ‘products’, ‘services’.

I think the problem comes from WP detecting something like /'s/ rather than /\w's/

Attachments (1)

curly_quotes_patch.diff (1.3 KB) - added by jmstacey 7 years ago.
Seems to fix the problem

Download all attachments as: .zip

Change History (23)

#1 @Denis de Bernardy
11 years ago

  • Patch set to No

#2 @rob1n
9 years ago

  • Keywords dev-feedback added

Is this still current in 2.1?

#3 @rob1n
9 years ago

  • Keywords needs-patch added; dev-feedback removed
  • Summary changed from text rendering to Curly quotes mixups

Yep. 2.1, you get:

‘products’, ’services’,

#4 @rob1n
9 years ago

  • Milestone set to 2.2
  • Version changed from 1.5.1 to 2.1

(Notice the direction of the curly quotes)

#5 @rob1n
9 years ago

  • Severity changed from trivial to normal

#6 @foolswisdom
9 years ago

  • Milestone changed from 2.2 to 2.4

#7 @rob1n
9 years ago

  • Milestone changed from 2.4 to 2.2
  • Owner changed from anonymous to rob1n

#8 @rob1n
9 years ago

  • Milestone changed from 2.2 to 2.3

#9 @rob1n
9 years ago

  • Owner rob1n deleted

#10 @Otto42
9 years ago

This is wp_texturize() doing this. It specifically replaces single-quote-S characters with ’s. This then messes up the normal quote matching to try to make the quotes prettier. Something a bit more clever in that function might be able to fix it, perhaps by looking for a letter (any letter) preceding the 's before thinking it should be an apostrophe?

#11 @markjaquith
8 years ago

  • Description modified (diff)
  • Milestone changed from 2.3 to 2.4 (next)

No patch -- punting.

#12 @pishmishy
8 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

I can't seem to replicate this in the trunk as of today. Posting:

'hello', 'world', 'tis

Appears to balance the quotes correctly.

#13 @lloydbudd
8 years ago

  • Milestone 2.4 deleted

#14 @HarryRAR
8 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Actually, this still isn't working in 2.5; I think it was closed by someone who didn't quite realise what the problem is. It's not balancing quotes, it's a specific problem with the single quote before a lower-case s. i.e. in 'salmon' or 'spook'.

#15 @HarryRAR
8 years ago

  • Version changed from 2.1 to 2.5

#16 @mtekk
8 years ago

Problem confirmed in latest SVN, it looks like it defaults to the ending curl, and for some reason has an additional rule to make sure that before an s does that too, when what it really should do is default as it does now, but if the preceding character is a space it should change to the beginning curl.

#17 @mtekk
8 years ago

I'm not proficient in regular expressions, but it looks like the function causing the problem is wptexturize(). There should be a simpler way of implementing the rules than what is there now, especially the arrays on lines 23 & 24. Anyways, anyone that is familiar with regular expressions can take a look at those two lines and it should be easy for them to fix.

7 years ago

Seems to fix the problem

#18 @jmstacey
7 years ago

  • Component changed from Template to General
  • Keywords has-patch added; needs-patch removed
  • Milestone set to 2.6

The patch I attached here is also included in a similar tweak for Ticket #4539. I apologize if this causes any trouble.

#19 @mrmist
7 years ago

  • Keywords has-patch removed
  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

Closing this as a dupe of #4539. No point having two bugs if the same patch fixes both.

#20 @westi
6 years ago

I have added some test cases for this issue to the wordpress-tests database.

#21 @HarryRAR
6 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Version changed from 2.5 to 2.9.2

I know this was lumped into another ticket, but since it's 5 years old and still hasn't been resolved I think it deserves a ticket of its own… apologies if I'm not using Trac properly, btw, but I only registered to report this bug three years ago, and every time there's an upgrade and it still hasn't been fixed it drives me nuts.

Still, until I can actually contribute some code, I guess I shouldn't whinge too much :)

#22 @nacin
6 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.