Working with a client who downgraded PHP 5.4 to 5.3 I have discovered that the issue appears to be restricted to PHP 5.4 and above, where the htmlspecialchars function's default character set was made UTF-8, as noted
here. Smart quotes do in fact appear to be supported under ISO-8859-1, used by LMP 1.88 and PHP 5.3.
Therefore, a better workaround than above for PHP 5.4+ might be (replacing $var with the proper variable name for each line):
htmlspecialchars($var, ENT_SUBSTITUTE, 'ISO-8859-1')
That way smart quotes may not be substituted with a UTF-8 sequence and need to be normalized. (Apparently PHP doesn't recognize them as ISO-8859-1 compatible characters in UTF-8 mode.)
The easiest way to avoid the issue is to avoid smart quotes entirely.
The issue will be fixed in a future update when LMP moves to the UTF-8 character set.
Regards