WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 4 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/
’s

Attachments (1)

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

Download all attachments as: .zip

Change History (23)

comment:1 Denis de Bernardy9 years ago

  • Patch set to No

comment:2 rob1n7 years ago

  • Keywords dev-feedback added

Is this still current in 2.1?

comment:3 rob1n7 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’,

comment:4 rob1n7 years ago

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

(Notice the direction of the curly quotes)

comment:5 rob1n7 years ago

  • Severity changed from trivial to normal

comment:6 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.4

comment:7 rob1n7 years ago

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

comment:8 rob1n7 years ago

  • Milestone changed from 2.2 to 2.3

comment:9 rob1n7 years ago

  • Owner rob1n deleted

comment:10 Otto427 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?

comment:11 markjaquith7 years ago

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

No patch -- punting.

comment:12 pishmishy6 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.

comment:13 lloydbudd6 years ago

  • Milestone 2.4 deleted

comment:14 HarryRAR6 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'.

comment:15 HarryRAR6 years ago

  • Version changed from 2.1 to 2.5

comment:16 mtekk6 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.

comment:17 mtekk6 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.

jmstacey6 years ago

Seems to fix the problem

comment:18 jmstacey6 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.

comment:19 mrmist5 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.

comment:20 westi5 years ago

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

comment:21 HarryRAR4 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 :)

comment:22 nacin4 years ago

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