1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed ' (and other HTML5 entities) in title for auto-link URL

Discussion in 'Resolved Bug Reports' started by Xon, Oct 7, 2015.

  1. Xon

    Xon Well-Known Member

    The ' HTML5 entity in the og:title meta tag are not being decode when a URL is automatically wrapped.

    For example: http://www.latimes.com/opinion/op-ed/la-oe-hemenway-guns-20150423-story.html
    Gets wrapped as: There's scientific consensus on guns -- and the NRA won't like it

    This is the line triggering it:
    Code:
    <meta property="og:title" content="There&apos;s scientific consensus on guns -- and the NRA won&apos;t like it" data-meta-updatable/>
    
    It looks like html_entity_decode needs to some flags to handle HTML5 explicitly rather than just HTML4. However, this was added in php 5.4 so some backwards compatibility care would need to be done.
     
    Liam W and Mouth like this.
  2. Mike

    Mike XenForo Developer Staff Member

    Just switched it to use HTML5 decoding if possible:
    Code:
    if (defined('ENT_HTML5'))
    {
        $title = html_entity_decode($title, ENT_QUOTES | ENT_HTML5, 'UTF-8');
    }
    else
    {
        $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
    }
    Seems to sort it and should be compatible with older versions (though the entities won't be decoded, as now).

    Thanks. :)
     
    HWS, Xon and Chris D like this.

Share This Page