WordPress.org

Forums

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

  1. Luke Janicke
    Member
    Posted 9 months 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.

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

  2. Jordy Meow
    Member
    Plugin Author

    Posted 8 months 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
    Member
    Plugin Author

    Posted 7 months ago #

    This issue has been resolved by the way :)

  4. Luke Janicke
    Member
    Posted 7 months ago #

    Nice one, mate!

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

  5. Jordy Meow
    Member
    Plugin Author

    Posted 7 months ago #

    You're welcome Luke :)

Reply

You must log in to post.

About this Plugin

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

About this Topic