The htmlentities function takes an $encoding argument. If the argument is omitted, the function ini_get( ‘default_charset’ ) will be used to determine the encoding charset, which will cause different results depending on the PHP configuration. Simply adding the argument ‘UTF-8’ to the function call solves the problem in this case.
$embedval = htmlentities(
apply_filters(
'infographic_embedder_image_code',
'<img src="' /... html link stuff .../ ',
), 'UTF-8'
);
This will only happen in some PHP versions. In PHP 5.4 and 5.5, UTF-8 is the default value for init_get( ‘default_charset’ ), so with those versions it works. Earlier versions of PHP use ISO-8859-1 as the default encoding value, and that should also work. So this problem really only occurs when using PHP 5.6 or greater.