Ticket #1418 (closed defect (bug): fixed)
wptexturize doesn't correctly translate doublequote in brackets
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9 |
| Component: | Formatting | Version: | 2.8.4 |
| Severity: | normal | Keywords: | dev-feedback has-patch needs-testing |
| Cc: | voyou1 |
Description
When a doublequote directly follows an opening bracket (parenthesis, etc), the quote is incorrectly translated to the closing doublequote ncr (”). I've modified line 30 of functions-formatting.php to partially account for non-whitespace characters before the opening quote.
Attachments
Change History
Kafkaesqui — 7 years ago
-
attachment
wptexturize.patch
added
comment:4
foolswisdom — 5 years ago
- Keywords has-patch dev-feedback added; bg|has-patch bg|dev-feedback removed
- Milestone changed from 2.2 to 2.3
- Keywords has-patch formatting wptexturize curl quotes removed
Patch won't apply -- for one thing the filenames are different now.
Also, I'm not fluent in REGEX, so I'm not sure. Probably needs testing.
comment:7
markjaquith — 4 years ago
- Milestone changed from 2.3 to 2.4 (next)
We need some examples of input text and output text (and desired output).
comment:8
jokeofalltrades — 4 years ago
Example: ("ABC") should render as (“NRDC”), but in fact renders as (”ABC“) - precisely backwards. These types of expressions are often used in legal texts (and lots of other texts) to signify abbreviations that will be used throughout the text the first time they are encountered. The only example I can find at the moment is here (search for "NRDC").
As far as I can see, ideal behavior for wptexturize would require that: (1) opening quotes (entities “ or ‘) never appear immediately before a closing bracket of any sort or whitespace of any sort; and (2) closing double quotes (entity ”) should never appear immediately after an opening bracket of any sort or whitespace of any sort.
The closing single quote (entity ’) is trickier, because there may be times when a parenthetical or other bracketed expression starts with a contracted year reference or a slang term ("cockney") beginning with an apostrophe (though these should be rare), and obviously any of those expressions will usually be preceded by whitespace.
The two rules above, though, should be top-level rules that trump all other smart-quote replacement rules, shouldn't they?
See also ticket #1258 for problems with quotes near whitespace.
comment:9
jokeofalltrades — 4 years ago
Oops, that should read: Example: ("ABC") should render as (“ABC”), but in fact renders as (”ABC“) - precisely backwards.
comment:11
Nazgul — 4 years ago
- Status changed from new to closed
- Resolution set to wontfix
- Milestone 2.5 deleted
I agree with thee17, so closing as wontfix for now.
Feel free to re-open if you have additional patches/information/suggestions/...
comment:12
voyou1 — 2 years ago
- Status changed from closed to reopened
- Cc voyou1 added
- Component changed from General to Formatting
- Version changed from 1.5.1.1 to 2.8.4
- Keywords recomend-closing removed
- Resolution wontfix deleted
I'm reopening, as this bug still exists. The current behaviour is:
- ("test") converts to (”test”)
- incorrect, should be (“test”)
- ('test') converts to (’test’)
- incorrect, should be (‘test’)
- ('twas) converts to (’twas)
- correct, cockney.
I've attached a patch against HEAD which fixes the two incorrect behaviours, and doesn't alter the third, correct, behaviour.
comment:15
westi — 2 years ago
- Status changed from reopened to closed
- Resolution set to fixed
Fixed in [11813]

Patch to functions-formatting.php for wptexturize doublequote regexp fix.