Support » Plugin: WP Retina 2x » Special characters in alt text break Picturefill method

  • Resolved Luke

    (@lukejanicke)


    Jordy, you probably remember my post recently about special characters. As I mentioned, I fixed that by stripping tags and escaping special characters.

    $alt = esc_attr( strip_tags( $alt ) );

    That works for standard special characters. Unfortunately, it doesn’t work for Latin characters with diacritic marks (āéǐòǖ) or Chinese characters (中文), both of which are used extensively on my site. The presence of those characters in an <img> alt attribute breaks the Picturefill method.

    Examples that break Picturefill…

    <img src="http://www.theharbiner.com/media/2014/07/-e6-9d-8e-e6-98-b1-e6-98-8e-900x675.jpg" alt="李昱明">

    Note: That number string is how “Media File Renamer” automatically renamed the image with a title that used Chinese characters (李昱明). Messy.

    <img src="http://www.theharbiner.com/media/2014/07/cafe-bu-bu.jpg.jpg" alt="Café Bubu">

    Anyway, it’s probably a bug with Picturefill and not your plugin. Hoping they’ll release a fix soon.

    https://wordpress.org/plugins/wp-retina-2x/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hey Luke,
    I just wanted to let you know that I am aware of this issue. It is not really to PictureFill but with a PHP core object (DOMDocument). It seems it’s skipping the IMG tags that contains this kind of characters. Not sure why yet…

    Plugin Author Jordy Meow

    (@tigroumeow)

    This issue has been resolved by the way 🙂

    Luke

    (@lukejanicke)

    Nice one, mate!

    I can put those alt attributes back in my theme/plugin. Cheers!

    Plugin Author Jordy Meow

    (@tigroumeow)

    You’re welcome Luke 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Special characters in alt text break Picturefill method’ is closed to new replies.