Project

General

Profile

Actions

Bug #34330

closed

Encoding error in flexform sections if backend is not UTF-8

Added by Helmut Hummel about 12 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2012-02-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

34330.patch (1.35 KB) 34330.patch Patch for Typo3 4.5.19 #34330 Ro!and Schorr, 2012-10-01 15:38

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #29067: Encoding UTF-8 in unescape functionClosed2011-08-18

Actions
Related to TYPO3 Core - Bug #32422: Encoding error in TCEforms inline JavaScriptClosedSteffen Gebert2011-12-09

Actions
Has duplicate TYPO3 Core - Bug #33377: Javascript error: URI malformed when adding new sectionsClosed2012-01-23

Actions
Actions #1

Updated by Helmut Hummel about 12 years ago

  • Status changed from New to Accepted
Actions #2

Updated by Steffen Ritter about 12 years ago

  • Status changed from Accepted to Needs Feedback

is this still valid since non-utf-8 backends are not possible anymore?

Actions #3

Updated by Helmut Hummel about 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

Actions #4

Updated by Ro!and Schorr over 11 years ago

Here's my patch for the current 4.5.19. I copied the original File

class.t3lib_tceforms.php
to
class.t3lib_tceforms.php,org
first:

--- class.t3lib_tceforms.php,org 2012-10-01 15:13:07.000000000 +0200
+++ class.t3lib_tceforms.php 2012-10-01 15:19:56.000000000 +0200
@ -2800,7 +2800,12 @
$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') )

Actions #5

Updated by Georg Ringer over 9 years ago

  • Status changed from Accepted to Resolved
  • Is Regression set to No

utf8 is now default

Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF