Bug #14714
closedPHP5, flexform and iso-8859-1 charset
0%
Description
I'm having some trouble with danish characters like 'æøå' and flexform (This problem apply to umloud etc. as well). If I writeone of those characters in my flexform field and I try to save, I get this error and the data is not saved (I tried setting "forceCharset" with install-tool to no effect.):
[client 127.0.0.1] PHP Warning: reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not an array or object in /home/ta/work/src/typo3_src-3.7.0/t3lib/class.t3lib_div.php on line 1398
The above error was because the XML parser returns "Invalid character" on a string "æøå" etc. - even if charset is set to iso-8859-1 (I tried hardcoding charset to iso-8859-1 too).
Now, I actually have come to some sort of solution, that seems to work. The trick is to use utf8_encode()/utf8_decode() and force flexform XML to charset utf-8.
The theory is that double encoded string:
$str = utf8_encode(utf8_encode($str));
is still utf-8 and can be decoded by
$str = utf8_decode(utf8_decode($str));
Thus this should work for both utf-8 and iso-8859-1.
I've attached a diff with patches for t3lib_div and t3lib_tcemain. Theese are tested at to different installations, and works as expected.
Regards
Tonni Aagesen
www.pil.dk & www.quickpay.dk
(issue imported from #M1053)
Files