Issue Bug Closed

#14714PHP5, flexform and iso-8859-1 charset

Tonni Aagesen 05/03/05, 10:34 updated 03/30/06, 13:39

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() [function.reset]: 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)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.