Project

General

Profile

Actions

Bug #22698

closed

Problems with xml parser and special chars by using ISO-8859-1 charset

Added by Stephan over 14 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-05-22
Due date:
% Done:

0%

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

Description

Hi,

on a new server I get the following error message by sending ISO-8859-1 coded FlexForms to Typo3 for saving:

t3lib_error_Exception
PHP Catchable Fatal Error: Argument 2 passed to t3lib_div::array_merge_recursive_overrule() must be an array, string given, called in /home/live/t3lib/class.t3lib_tcemain.php on line 1849 and defined in /home/live/t3lib/class.t3lib_div.php line 1960

Related issue: If I try to get some special chars from the database into a flexform, no data will be displayed.

So I have done a little bit of research and found the solution to just change the charset to utf-8. A difficult thing if the sites exists already with many modules. So I tried to get another solution. And here we are:

I looked into the core and found the line which makes problems:

In the class class.t3lib_div.php there is a function xml2arrayProcess. In there is a line

$parser = xml_parser_create();

For solving this issue I just did the following: Just copied the lines

$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');

over the $parser = line above and changed the line to

$parser = xml_parser_create($theCharset);

Thats it. No more errors and I had not to change the charset of the existing site.

Maybe this helps fixing this issue, there are several posts in forums with the same problem.

Kind regards,
Stephan

(issue imported from #M14459)


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #22007: In a flexform extension, any "special characters" (UTF-8 characters) will throw an errorClosedChris topher2010-01-22

Actions
Actions

Also available in: Atom PDF