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".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rainworks’s picture

This 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.)

Tritof’s picture

+1, version 7.x-4.0-alpha2

Tritof’s picture

Issue summary: View changes

Made special chars visible

matglas86’s picture

Version: 7.x-4.0-alpha1 » 7.x-4.x-dev
Issue summary: View changes
Status: Active » Needs review
FileSize
830 bytes

I 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.

Vincent Verheyen’s picture

@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. =)

KarlShea’s picture

Status: Needs review » Reviewed & tested by the community

This fixed my issue.

matglas86’s picture

Status: Reviewed & tested by the community » Fixed

  • matglas86 committed ec39768 on 7.x-4.x
    Issue #1795506 by matglas86: Special characters rendered as html...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

janaameier’s picture

Bumping this issue. htmlspecialchars http://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.

Yury N’s picture

FileSize
543 bytes

I've faced same issue as described in #9 but with French. Attaching patch.