Project

General

Profile

Bug #14714 ยป div_tcemain.diff

Administrator Admin, 2005-05-03 10:34

View differences:

class.t3lib_div.php 2005-05-02 21:41:33.000000000 +0200
$content = chr(10).chunk_split(base64_encode($v));
$attr.=' base64="1"';
} else {
// Otherwise, just htmlspecialchar the stuff:
$content = htmlspecialchars($v);
// If we use php5 force convertion from iso-iso8859-1 to utf-8
if ((double)phpversion()>=5) {
$theCharset = isset($TYPO3_CONF_VARS['BE']['forceCharset']) ? $TYPO3_CONF_VARS['BE']['forceCharset'] : $GLOBALS['LANG']->charSet;
$theCharset = ($theCharset == 'iso-8859-1') ? 'utf-8' : $theCharset;
$content = ($theCharset == 'utf-8') ? utf8_encode(htmlspecialchars($v)) : htmlspecialchars($v);
} else {
$content = htmlspecialchars($v);
}
$dType = gettype($v);
if ($dType!='string') { $attr.=' type="'.$dType.'"'; }
}
......
unset($ereg_result);
ereg('^[[:space:]]*<\?xml[^>]*encoding[[:space:]]*=[[:space:]]*"([^"]*)"',substr($string,0,200),$ereg_result);
$theCharset = $ereg_result[1] ? $ereg_result[1] : ($TYPO3_CONF_VARS['BE']['forceCharset'] ? $TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1');
// Set charset to utf-8 if current BE charset is iso-8859-1
$theCharset = $theCharset == 'iso-8859-1' ? 'utf-8' : $theCharset;
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $theCharset); // us-ascii / utf-8 / iso-8859-1
}
......
case 'array':
$current[$tagName] = array(); // MUST be an empty array since it is processed as a value; Empty arrays would end up here because they would have no tags inside...
break;
default:
$current[$tagName] = ((double)phpversion()>=5 && $theCharset == 'utf-8') ? utf8_decode($current[$tagName]) : $current[$tagName];
break;
}
}
break;
-- class.t3lib_tcemain.php.orig 2004-09-24 13:06:11.000000000 +0200
++ class.t3lib_tcemain.php 2005-05-02 21:47:51.000000000 +0200
......
// Create XML and convert charsets from input value:
$xmlValue = $this->checkValue_flexArray2Xml($value);
// If we use php5 force convertion from iso-iso8859-1 to utf-8
if ((double)phpversion()>=5) {
$storeInCharset = isset($TYPO3_CONF_VARS['BE']['forceCharset']) ? $TYPO3_CONF_VARS['BE']['forceCharset'] : $GLOBALS['LANG']->charSet;
$storeInCharset = ($storeInCharset == 'iso-8859-1') ? 'utf-8' : $storeInCharset;
} else {
$storeInCharset = isset($TYPO3_CONF_VARS['BE']['forceCharset']) ? $TYPO3_CONF_VARS['BE']['forceCharset'] : $GLOBALS['LANG']->charSet;
}
// If we wanted to set UTF fixed:
// $storeInCharset='utf-8';
//$storeInCharset='utf-8';
// $currentCharset=$GLOBALS['LANG']->charSet;
// $xmlValue = $GLOBALS['LANG']->csConvObj->conv($xmlValue,$currentCharset,$storeInCharset,1);
$storeInCharset=$GLOBALS['LANG']->charSet;
// $storeInCharset=$GLOBALS['LANG']->charSet;
// Merge them together IF they are both arrays:
// Here we convert the currently submitted values BACK to an array, then merge the two and then BACK to XML again. This is needed to ensure the charsets are the same (provided that the current value was already stored IN the charset that the new value is converted to).
    (1-1/1)