Problem/Motivation
The title of a node is encoded on rendering because of the addthis:title attribute. This produces a encoded string that is passed to twitter. For example "Blog's blog".
This problem does not exist with the AddThis Block that is using the global title of the screen.
Proposed resolution
Replace the check_plain of the entity with htmlentities function to replace only the double-qoutes.
Remaining tasks
Testing
Original report by @Leo Pitt
The website I am working on uses an AddThis widget on blog posts. If the blog post title contains an apostrophe - e.g. "Blog's blog", when shared with Twitter this appears rendered as "Blog's blog".
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | title_html_specialchars-1795506-10.patch | 543 bytes | yury n |
Comments
Comment #1
rainworks commentedThis is also happening for me in 6.x-3.0-beta2. (Not sure if I should open a separate issue report for a different version.)
Comment #2
tritof commented+1, version 7.x-4.0-alpha2
Comment #2.0
tritof commentedMade special chars visible
Comment #3
matglas86 commentedI have replaced the check_plain with a htmlentities that only replaces the double quotes, because it can not be used in a html attribute. If you want to disable the addthis:title attribute, which makes the title specific for a share widget than you have to use the
hook_addthis_markup_alter.Comment #4
Vincent Verheyen commented@matglas86 - That's a great patch! Have you got any idea on the
"double quotes"yet?Quite a coincidence, but do I understand you correctly that you talk about changing the input for an Addthis Share? At least, it seemed like that. Might I then ask if you have any idea on how I could get the following token of the fields:
[node:field_article_title]and[node:field_article_subtitle]into the Addthis sharing input? I might create another issue about it. =)Comment #5
karlsheaThis fixed my issue.
Comment #6
matglas86 commentedComment #9
janaameier commentedBumping this issue.
htmlspecialcharshttp://php.net/manual/en/function.htmlspecialchars.php should probably be used instead, since we only need to escape chars which have a meaning in HTML. The current implementation (htmlentities), will also escape other special chars, such as Danish æ,å,ø etc.Comment #10
yury n commentedI've faced same issue as described in #9 but with French. Attaching patch.