I was have an issue with Apostrophe's showing up in the meta tag of a page as
Turchenek's
The actual source code read: Turchenek's
I adjusted line 267 in open graph_meta.common.inc to:
case self::TITLE:
$v = htmlspecialchars_decode($v);
break;Checking the meta output here:
http://www.google.com/webmasters/tools/richsnippets
Is this correct? Is this how it is supposed to be with single quotes in the title?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | opengraph_meta-html-entities-1376716.patch | 903 bytes | jamix |
| #3 | opengraph_meta-htmlspecialchars_decode.patch | 847 bytes | jamix |
Comments
Comment #1
hiddentao commentedThis might be worth fixing on a more general level.
Comment #2
skrichten commentedYes definitely,
We have this same issue, do you plan to have a fix in the next release and if so, when do you think that will be?
Comment #3
jamix commentedThe problem here is that htmlspecialchars_decode() only decodes a small subset of HTML entities, and
'is not among them unless the ENT_QUOTES flag is set. A better solution seems to be to use Drupal's decode_entities() instead, which will decode all HTML entities via html_entity_decode(). See the attached patch.Comment #4
Jerimee commentedSame problem here. Please commit a change like those proposed.
Comment #5
jamix commentedIn fact, double quotes still appeared encoded even with the patch from #3 applied. It turned out that running the title through
htmlspecialchars()isn't necessary because HTML encoding is done in D7'stheme_html_tag(). The attached patch removes thehtmlspecialchars()call while making sure that in D6, proper escaping is done before the meta tag is output.Comment #6
torotil commentedHi,
I'm the new maintainer of opengraph_meta. Sorry for the long silence in the issue queue.
Sadly I don't have the resources to care for the Drupal 6 version. Unless and until someone steps up to maintain it I'm therefore closing all D6 issues as WONTFIX.
Feel free to re-open the issue if it is still valid in one of the Drupal 7 branches.
Thanks!
Comment #7
arnoldbird commentedI'm running into this same issue in 7.x-1.3.
Comment #8
arnoldbird commentedI implemented the first of the two code changes in the patch in #5 in version 7.x-1.3. This seems to resolve the problem, but I'm not sure. The change does prevent the double-encoding of a single quote in the title. Meanwhile, though, I'm not totally sure if these characters should be encoded at all when I look at the page source. I don't know the reasoning behind encoding a character in a meta tag.
It's beyond the scope of this module, but just for background, I'm trying to implement a like button as described at https://developers.facebook.com/docs/plugins/like-button -- I'm finding that in the popup box that appears when I click the like button, the character encoding is getting passed to the output as if it is double-encoded in the meta tag. However, that happens whether or not the character is double encoded in the metatag.
Comment #9
arnoldbird commentedOn further review, I don't think a single quote should be encoded at all in the meta tag. When I look at the page source, I should see this...
<meta property="og:title" content="Ryan's Test" />...rather than...
<meta property="og:title" content="Ryan's Test" />Am I right so far? The latter is what I'm seeing, so I'd say this is a valid bug and still needs fixing.
Comment #10
sivaprasadc commentedHi Guys,
The Patch #5 is worked fine for me. Thank you All.