WP Retina 2x
[resolved] Special characters in alt text break Picturefill method (5 posts)

  1. lukejanicke
    Posted 1 year ago #

    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.


  2. Jordy Meow
    Plugin Author

    Posted 1 year ago #

    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...

  3. Jordy Meow
    Plugin Author

    Posted 1 year ago #

    This issue has been resolved by the way :)

  4. lukejanicke
    Posted 1 year ago #

    Nice one, mate!

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

  5. Jordy Meow
    Plugin Author

    Posted 1 year ago #

    You're welcome Luke :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Retina 2x
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic