I am looking at Smarty v2.6.19 (most recent version).
Open
Smarty.class.php and scroll to the method
_read_file() on line 1707:
PHP Code:
/**
* read in a file
*
* @param string $filename
* @return string
*/
function _read_file($filename)
{
if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
$contents = '';
while (!feof($fd)) {
$contents .= fread($fd, 8192);
}
fclose($fd);
return $contents;
} else {
return false;
}
}
Replace it with this one:
PHP Code:
/**
* read in a file
*
* @param string $filename
* @return string
*/
function _read_file($filename)
{
if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
$contents = '';
while (!feof($fd)) {
$contents .= fread($fd, 8192);
}
fclose($fd);
$contents = removeBOM( $contents ); // customization: remove byte-order marks
return $contents;
} else {
return false;
}
}
Untested, but it should do what you're looking to accomplish.