Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There's a couple issues in the queue related to single quotes being double-escaped, including #559056: Fields with apostrophes not displaying correctly and #1373584: Apostrophes (single quotes) in token values used for link path in "Output this field as a link" are double-escaped. Drupal has a decode_entities() function to "undo" a check_plain(), so here's a patch that changes all occurrences of html_entity_decode() to decode_entities().
Comment | File | Size | Author |
---|---|---|---|
#7 | views_apostrophe_broken.png | 147.01 KB | mennonot |
#1 | 1373588-decode_entites-6.patch | 4.55 KB | dawehner |
views-decode_entities.patch | 4.66 KB | effulgentsia | |
Comments
Comment #1
dawehnerWow i never saw this function before, drupal is full of hidden awesomeness. Thanks for fixing this issue on such many places,
as all of them were potential bugs. Committed the patch to 7.x-3.x, sadly the patch didn't applied to 6.x-3.x, so i created one.
Comment #2
byrond CreditAttribution: byrond commentedLooks like the first patch has already been committed to 7.x-3.x-dev.
http://drupalcode.org/project/views.git/commit/dcf5b6acfcbe5546bde0e2c81...
Comment #3
mennonot CreditAttribution: mennonot commentedAny idea when this patch will be applied to 6.x-3.x-dev? Or has it already been?
Comment #4
effulgentsia CreditAttribution: effulgentsia commented@dereine, your patch looks like a straight port of the D7 patch, so I'm marking it RTBC. If you intended to leave it as "needs review", because you were actually looking for a D6-targeted review, please kick it back.
Comment #5
dawehnerCommitted to 6.x-3.x as well. Thanks for the review
Comment #7
mennonot CreditAttribution: mennonot commentedI installed the most recent version of Views 6.x-3.x-dev (updated 2012-Mar-09) and the apostrophe issue is not fixed. It looks like the patch in this thread has not been applied yet. I checked the first instructions in the patch by opening up /handlers/views_handler_field.inc and found that at line 941 its still using html_entity_decode instead of decode_entities:
If 1373588-decode_entites-6.patch (attached to comment #1 above) had been applied, it should have read like this:
I've also attached a screenshot of a caption mangling an apostrophe with 6.x-3.x-dev installed.
Comment #8
mcdruidThis change would also fix an issue we've come across over in Advanced Forum:
#1361526: htmlspecialchars() error with views created by AF
I can confirm that changing to decode_entities (or adding 'UTF-8' as the optional 3rd param to html_entity_decode) resolves the "htmlspecialchars(): Invalid multibyte sequence in argument" warning which is emitted by check_plain in certain circumstances.
I don't know if the same error has come up in any other context, or whether you'd like a new issue opened in the views queue for this?
Comment #9
mcdruid...and that IIUC it looks like the patch has yet to land in the latest dev releases as of today (at least in terms of replacing the occurrence which is causing AF problems):
Comment #10
_vid CreditAttribution: _vid commentedIt's not in the views 6.x-3.x-dev 2012-Mar-23 release either.
Comment #11
RedRat CreditAttribution: RedRat commentedRaised priority accordantly with http://drupal.org/node/45111 and changed status to "tested by community" since this patch already in the 7.x branch. We really need this bug to be fixed!
Comment #12
mennonot CreditAttribution: mennonot commented+1 for getting this patch added. It looks like this bug may break the views integration with SlideShowPro (http://drupal.org/project/ssp). When views sends a caption with a double escaped apostrophe or quote to SlideShowPro, the player won't load at all
Comment #13
peatonI'm using 7.x-3.3+155-dev and still have this issue with the apostrophe. Is the patch not included in that dev version?
Comment #14
dawehnerI disagree with being major, as major is not meant to be for your website but for the module, anway.
It is a bit confusing because noone actually verified that the attached patch is working fine for them.
Comment #15
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue