Bug #34330
closedEncoding error in flexform sections if backend is not UTF-8
0%
Description
#29067 introduced a regression, because the inline javascript was encoded twice. This was fixed in #32422 but this unfortunately introduced a regression for non UTF-8 backends.
The reason for the latter is that json_encode can only handle UTF-8 encoded strings.
Solution:
Encode the string to UTF-8 before handing it over to json_encode
Files
Updated by Steffen Ritter over 12 years ago
- Status changed from Accepted to Needs Feedback
is this still valid since non-utf-8 backends are not possible anymore?
Updated by Helmut Hummel over 12 years ago
- Status changed from Needs Feedback to Accepted
- TYPO3 Version changed from 4.7 to 4.6
It's still valid for TYPO3 <= 4.6
Updated by Ro!and Schorr about 12 years ago
- File 34330.patch 34330.patch added
Here's my patch for the current 4.5.19. I copied the original File
class.t3lib_tceforms.phpto
class.t3lib_tceforms.php,orgfirst:
--- class.t3lib_tceforms.php,org 2012-10-01 15:13:07.000000000 +0200
@ -2800,7 +2800,12
+++ class.t3lib_tceforms.php 2012-10-01 15:19:56.000000000 +0200@
$replace .= '.replace(/(tceforms-(datetime|date)field-)/g,"$1" + (new Date()).getTime())';
$onClickInsert = 'var ' . $var . ' = "' . 'idx"+(new Date()).getTime();';
// Do not replace $isTagPrefix in setActionStatus() because it needs section id!
- $onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), ' . json_encode($newElementTemplate) . '.' . $replace . '); setActionStatus("' . $idTagPrefix . '");';
+ if ( (strtolower($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']) ===
+'utf-8') )
+ $newElementTemplatePatched = $newElementTemplate;
+ else
+ $newElementTemplatePatched = utf8_encode( $newElementTemplate );
+ $onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), ' . json_encode( $newElementTemplatePatched ) . '.' . $replace . '); setActionStatus("' . $idTagPrefix . '");';
$onClickInsert .= 'eval(unescape("' . rawurlencode(implode(';', $this->additionalJS_post)) . '").' . $replace . ');';
$onClickInsert .= 'TBE_EDITOR.addActionChecks("submit", unescape("' . rawurlencode(implode(';', $this->additionalJS_submit)) . '").' . $replace . ');';
$onClickInsert .= 'TYPO3.TCEFORMS.update();';
Please note: This patch should not be used for TYPO3 Version >= 4.6, since this will probably fail:
if ( (strtolower($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']) === 'utf-8') )
Updated by Georg Ringer almost 10 years ago
- Status changed from Accepted to Resolved
- Is Regression set to No
utf8 is now default