Closed (fixed)
Project:
File Entity (fieldable files)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 May 2013 at 08:10 UTC
Updated:
27 Jun 2018 at 16:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
aaron commentedIt appears that the quotes are being double-encoded.
Comment #2
sgurlt commentedWhat do you exactly mean with "double-encoded"?
And why did you Change the Topic?
Comment #3
mgiffordSo the question is if the html entities are allowed in alt tags?
<img class="panopoly-image-thumbnail" width="80" height="60" title="" alt="alt & stuff's for testing purposes!" src="http://parks.testing/sites/parks/files/styles/panopoly_image_thumbnail/public/Alberta/Baru/dsc00258-2.jpg?itok=M_mqamEc" typeof="foaf:Image">Double encoding would be
&amp;which I don't see.Comment #4
mgiffordI just checked, and ya, any use of HTML entities in alt text is a problem for screen readers:
https://twitter.com/jared_w_smith/status/349528889871183873
https://twitter.com/jared_w_smith - You can't use encoded characters. I think only option is to use opposite quotes - alt='say "hi"' or alt="say 'hi'".
https://twitter.com/sebcbien - in French alt="dis « salut »" ;)
Comment #5
gmclelland commentedJust tested and confirming that this is still an issue with the latest devs of media and file_entity.
Comment #6
sgurlt commentedAnything new about this?
Comment #7
Anonymous (not verified) commentedHere we go!
Comment #9
Jason Dean commented#7 worked for me, but note that it needs to be applied to File Entity module
Thanks!
Comment #10
bneil commentedComment #11
forestgardener commentedI am having the same problem with apostrophes. They are stored as apostrophes in field_file_image_alt_text and field_file_image_title_text attached to the image file, but when viewed in a content type, view, or as a file any apostrophes display as the string ampersand, hash, 039, semi colon
I am using the latest dev versions of file entity and media.
Comment #12
gmclelland commented#7: alt_title_double_encoding-1987568-7.patch queued for re-testing.
Comment #13
gmclelland commented@forestgardener - have you tried patching the file_entity module with the patch in #7?
Comment #14
forestgardener commentedHi Glenn
No I hadn't tried the patch in #7. I was cautious due to the 'failed testing' message. I have now applied the patch (from comment 12) and this has solved the problem.
Thanks for your help.
Craig
Comment #15
mgifford7: alt_title_double_encoding-1987568-7.patch queued for re-testing.
Comment #16
matkeane commentedI just tested the patch in #7 with File Entity 7.x-2.0-alpha3 & Media 7.x-2.0-alpha3 and it seems to be working as intended, at least as far as my case in concerned - French accents no longer appear as HTML entities, but display properly.
Comment #17
ckngTested patch #7, working well.
Comment #18
mgifford@ckng can you mark this RTBC?
Seems like a simple patch involving mostly decode_entities().
Comment #19
devin carlson commentedI believe that this is due to the field tokens used for alt and title text not using the raw field value (raw field tokens aren't currently available, see #1713164: field_tokens() isn't respecting sanitize option).
If you undo the encoding done during tokenization then alt and title text work correctly.
The attached patch adds test coverage to the solution implemented in #7. Unfortunately it required the Token module which is not currently a test dependency for File Entity so it will not fail on Drupal.org (which would require a new release of File Entity to be rolled) but will fail locally if you have the token module available.
Comment #21
devin carlson commentedComment #22
devin carlson commentedRetested #21 and verified that the alt and title text appeared correctly and was still able to be edited. I also tested to make sure that the text was still properly sanitized.
Committed to File entity 7.x-2.x.
Comment #25
heddnComment #26
liquidcms commentedChecking if I have this correct; but quotes etc used to be encoded but this causes issues for screen readers; so this patch was to no longer encode?
So if i use double quotes in ALT text i now get double quotes inside the alt=" "; which of course also fails. :(
So we leave it up to the content editors to make sure to not use double-quotes?
Comment #27
liquidcms commentedTurns out it was just the slider module i was using which was NOT htmlentifying the quotes within the ALT. A quick check of D7 and D8 core image fields shows that these are entified; which from the sounds of this post may be an issue for screen readers.
Comment #28
joseph.olstadHi @LiquidCMS,
regarding comment #27 , I just checked the 'slider' module, it's for 6.x , however the last comment was made to this issue which is a file_entity 7.x-2.x issue. Can you please provide a link to the mentioned project? Are you also going to provide a patch for the said project? If so, can we have a link to it please?
Thanks