jtsternberg / DsgnWrks-Instagram-Importer

Backup your instagram photos & display your instagram archive. Supports importing to custom post-types & adding custom taxonomies.
http://wordpress.org/extend/plugins/dsgnwrks-instagram-importer/
33 stars 17 forks source link

Emojis in instagram text break things #15

Closed domani-cclark closed 5 years ago

domani-cclark commented 10 years ago

Awesome plugin! The only issue I encountered was with emojis in the insta-text. This would break and wordpress would throw

PHP Warning: htmlspecialchars(): Invalid multibyte sequence in argument

I got around this by running a remove emoji function before saving to the db

function removeEmoji($text) {

    $clean_text = "";

    // Match Emoticons
    $regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
    $clean_text = preg_replace($regexEmoticons, '', $text);

    // Match Miscellaneous Symbols and Pictographs
    $regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
    $clean_text = preg_replace($regexSymbols, '', $clean_text);

    // Match Transport And Map Symbols
    $regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
    $clean_text = preg_replace($regexTransport, '', $clean_text);

    return $clean_text;
}

I would definitely recommend implementing into the plugin!

jtsternberg commented 10 years ago

Interesting.. I'm not sure why'd you be receiving this error since we're not using the htmlspecialchars function anywhere.

domani-cclark commented 10 years ago

The plugin isn't throwing the error, rather WP throws it whenever it tries to display the content as it runs htmlspecialchars and doesn't recognize the characters. To avoid this we stripped out the emoji characters before saving to the DB.

On Wednesday, May 21, 2014, Justin Sternberg notifications@github.com wrote:

Interesting.. I'm not sure why'd you be receiving this error since we're not using the function anywhere.

— Reply to this email directly or view it on GitHubhttps://github.com/jtsternberg/DsgnWrks-Instagram-Importer-WordPress-Plugin/issues/15#issuecomment-43841631 .

_Charlie Clark_Interactive Developer

45 Main St. Suite 206 Brooklyn, NY 11201 tel: 718.797.4470 fax: 610.728.0033

Follow us on Twitter

NEWS & WHATNOT:

_• Dual screen experience for Stephen King's sequel to The Shining: Glimpse into the tortured mind of Danny Torrance http://www.doctorsleepbook.com/where-is-danny-torrance/__• Responsively designed global site for Westin: Westin Finds from AFAR http://westinfinds.com/._

baptistebriel commented 8 years ago

Hi,

A came across the same issue, but here the emojis are replaced by a question mark ? Any ideas how I could remove them from the title & excerpt?

Thanks!

jtsternberg commented 5 years ago

This is old, so I'm closing. Re-open if you are still having issues.