[TYPO3-dev] FlexForms and utf-8

Bernhard Kraft kraftb at kraftb.at
Tue Jan 31 04:02:27 CET 2006


Ernesto Baschny [cron IT] wrote:

> I've just tried the last patch (2005-12-13) and it doesn't solve the
> select-box problem with UTF-8 chars. Bernhard, I would appreciate if you
> take a look at http://bugs.typo3.org/view.php?id=2396 to see if we can
> work on that to find a solution to that (other) UTF-8 problem.


Hi Ernesto and Thomas !

Ernesto, your bug description on bugs.typo3.org is excellent ! I wish reports
would always be like that !!!


I tought a lot about how to fix this ... Let me explain the problem:

in t3lib/class.t3lib_tceforms.php there is a method "getSingleField_typeSelect_multiple"
... this one is responsible for rendering all of those "multiple" select boxes with 2 select
boxes - one on the left and the other on the right side.

The method passes the value it get's from previous method through $GLOBALS['LANG']->sL which
converts a LanguageLabel to the used charset (it leaves it untouched normally but converts it
if forceCharset is used). But now the problem is that when a database relation get's rendered
the values are already in the "correct" charset and don't need to get converted again (at least
if forceCharset is used - without force charset it is always assumed that the content in the DB
is in the Charset of the actual user.
So the value fetched from the db (utf-8) get's converted from the original charset of the user
(iso-8859-1 when english is used) to utf-8 again ... meaning all utf-8 entities get interpreted
as 8859-1 chars.


Finally I had to dig into class.t3lib_transferdata.php to solve the problem. I just removed the
->sL from tceforms and encoded the value already in transferdata - this is rather the correct
location for the charset transformation as this method knows about the origin of the string (LL files,
DB, etc.) - and if you look at class.t3lib_transferdata.php into method "selectAddSpecial" which get's
called from the "main" select-handle-method "renderRecord_selectProc" you will see that there are already
language conversion made there ...

So I simply added the ->sL statement where the TCA "items" array of a select field get's processed and
left the contents fetched from the db untouched.


I uploaded a bugfix to the bugtracker on your report:
http://bugs.typo3.org/view.php?id=2396
( bug_2396_2006-01-30.diff )


Please report back if this fixes your problem and if it does I will send it to the core list for CVS approval



greets,
Bernhard






More information about the TYPO3-dev mailing list