in the php documentation for htmlspecialchars
:
Encoding: Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.
so, based on that, I tried setting the fields explicitly, so they would not default to different things silently.
htmlspecialchars( $string , ENT_COMPAT, 'UTF-8' );
now the output is the same between the two different environments.