Project

General

Profile

Bug #20671 ยป class.t3lib_div.php.patch

Steffen Gebert, 2011-12-26 13:28

View differences:

class.t3lib_div.php.new 2009-06-25 13:41:48.000000000 +0200
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
// default output charset is UTF-8, only ASCII, ISO-8859-1 and UTF-8 are supported!!!
$match = array();
preg_match('/^[[:space:]]*<\?xml[^>]*encoding[[:space:]]*=[[:space:]]*"([^"]*)"/',substr($string,0,200),$match);
$theCharset = $match[1] ? $match[1] : ($TYPO3_CONF_VARS['BE']['forceCharset'] ? $TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1');
// Check for UTF-8 BOM
if(substr($string, 0,3) == chr(0xEF).chr(0xBB).chr(0xBF)) {
$string = substr($string, 3);
$theCharset = 'utf-8';
}
else {
preg_match('/^[[:space:]]*<\?xml[^>]*encoding[[:space:]]*=[[:space:]]*"([^"]*)"/',substr($string,0,200),$match);
$theCharset = $match[1] ? $match[1] : ($TYPO3_CONF_VARS['BE']['forceCharset'] ? $TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1');
}
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $theCharset); // us-ascii / utf-8 / iso-8859-1
// Parse content:
xml_parse_into_struct($parser, $string, $vals, $index);
    (1-1/1)