osCommerce notes, 2.3.x and php 5.4

Funny, but uncommon problem – very old and customized osCommerce version and hosting provider forced to switch PHP version to at least 5.4.

As always there is no time rework site, so let’s do some workarounds…

Charset – site started ten or fifteen years ago, for local only market so non Unicode charset sounded as not very bad idea. Wrong.

Something gone wrong PHP 5.4 and windows-1257 (who remembers these?) support, so htmlspecialchars() acts so much secure – returns text to first non ASCII symbol…

So workaround – double conversion to and from UTF-8 :)

[code]
diff catalog/admin/includes/functions/general.php,<em> function tep_output_string</em>


-return htmlspecialchars($string);

+return iconv("UTF-8", "windows-1257", htmlspecialchars(iconv("windows-1257", "UTF-8", $string)));
[/code]