Support » Plugin: Twitter Feed: Embedded Timeline WordPress Plugin » Hash tags get confused with HTML entities

  • Resolved Eric_WVGG

    (@cowboy_x)


    I have a client who is using coded entities in his tweets — like & #8212; to do an em-dash. These are getting interpreted by the plugin as hash tags leading to “#8212” and breaking up the feed. (I assume they’re being generated by a cruddy Twitter client that isn’t converting entities to UTF-8.)

    I was able to fix this by editing your plugin by adding a space in your regular expression for detecting hash tags. A better version would check for the non-existence of an ampersand before the string, but I’m lazy.

    input:
    Ever wonder what is exactly meant by the 'flipped classroom'?

    output:
    Ever wonder what is exactly meant by the &<a href="http://twitter.com/search?q=%23039" rel="nofollow">#039</a>;flipped classroom&<a href="http://twitter.com/search?q=%23039" rel="nofollow">#039</a>;?

    line 208, edited:
    $tweet = preg_replace("( #([a-zA-Z0-9\_]+))", " <a href=\"http://twitter.com/search?q=%23\\1\" rel=\"nofollow\">\</a>", $tweet);

    http://wordpress.org/extend/plugins/wp-twitter-feed/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thanks, Cowboy_X. Hope this gets added to the new version. Mine was apostrophes turning into #039;.

    Note that encoding=”yes” does NOT fix the problem.

    Hi Cowboy_X,
    Would you know what I would need to change to prevent ‘&’ being
    displayed as ‘& amp;’ (but then withouth the space)?
    TIA

    Thank you Cowboy_X, with this amend works perfect.

    Plugin Author Alex Moss

    (@alexmoss)

    Hey guys – I’ve just updated to 1.2.2. Use decode=”yes” in the shortcode to apply this fix.

    Thanks guys 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hash tags get confused with HTML entities’ is closed to new replies.