Hi! Sorry for my English(

I use the Metatag module on this site http://aa-lol.ru/63
In open graph meta tag ("description") html tags doesn't encoding like this:

<meta property="og:description" content="<strong>&#8220</strong>;Three Centuries on the Hudson River<strong>&#8221</strong>; is a book about Hoogebergh, a 1696 family homestead in upstate New York, and the eleven generations of the Staats family who have live >strong>&nbsp;>/strong>there.
Th" />

When I share posts in facebook, it merges into a single line(

How can I enable encoding HTML chars?

Please, help!

Comments

ArtoRovie’s picture

Issue summary: View changes
ArtoRovie’s picture

Issue summary: View changes
ArtoRovie’s picture

Issue summary: View changes
damienmckenna’s picture

Version: 7.x-1.0-beta9 » 7.x-1.x-dev
Component: Open Graph » Other tags
Category: Support request » Bug report

I think this is because strip_tags() is ran on the values, and then they're ran through check_plain() again before they're finally output.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.22 KB

Does this resolve the problem?

damienmckenna’s picture

Issue summary: View changes
damienmckenna’s picture

Issue summary: View changes
damienmckenna’s picture

markdorison’s picture

I am still encountering this issue even with the patch in #5 applied. Example output:

<meta name="description" content="This rich yet simple chocolate cake gets a little kick from a&nbsp;touch of smoked Spanish paprika and espelette. Espelette is a smoky&nbsp;chile powder from France.">

damienmckenna’s picture

StatusFileSize
new1.69 KB

@markdorison: If you see "&nbsp;" in a field it comes from the source field's data. That said, because it's a known problem we can fix it.

markdorison’s picture

@DamienMcKenna: I applied the patch in #10 and I was still seeing the issue. When I var_dump() $value before your changes, I am not seeing &nbsp but instead the a-circumflex character:

"This rich yet simple chocolate cake gets a little kick from a touch of smoked Spanish paprika and espelette. Espelette is a smoky chile powder from France."

Some searching (https://www.google.com/search?q=nbsp+a-circumflex&oq=nbsp+a-circumflex) describes this as a character encoding issue. It seems to be converting successfully back to &nbsp by the time it makes it to the browser, but at the point you are trying to replace &nbsp, there isn't one there to replace.

damienmckenna’s picture

There's a very fine line between correcting encoding errors and screwing up a non-English site. That's one reason that delving further into this makes me nervous. Out of interest, for the node with the a-circumflex problem, do you also see that character in the node display itself?

markdorison’s picture

@DamienMcKenna: By the time the text makes it into markup it seems to have reverted back to the expected &nbsp. The only place I have seen the a-circumflex is when I var_dump() the value in tidyValue().

damienmckenna’s picture

StatusFileSize
new1.77 KB

How does this work?

markdorison’s picture

@DamienMcKenna #14 works for me.

damienmckenna’s picture

Status: Needs review » Fixed

@markdorison: Thanks for letting me know.

I've committed this.

  • DamienMcKenna committed a423200 on 7.x-1.x
    Issue #2202031 by DamienMcKenna: Don't double-encode output, handle...
markdorison’s picture

@DamnienMcKenna: Absolutely; thank you for the fix!

dave reid’s picture

I'm confused. Why wouldn't decode_entities() call itself convert ' ' to a space? That's what it's designed to do.

damienmckenna’s picture

$ php -r 'print ord(html_entity_decode("&nbsp;")) . "\n";'
160
$ php -r 'print ord(html_entity_decode(" ")) . "\n";'
32

This difference is why.

Status: Fixed » Closed (fixed)

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