[TYPO3-dev] FlexForms and utf-8
Ernesto Baschny [cron IT]
ernst at cron-it.de
Thu Jan 26 16:51:25 CET 2006
Thomas Hempel schrieb am 16.01.2006 13:45:
> I'm not sure if this question was allready asked before. I didn't found
> any hints here or in the bugtracker.
>
> Has anyone an idea how the flexform structures can be made utf8 ready?
> When I encode my flexform structure with utf8, the backendforms didn't
> display it right. Any ideas or hints where I can find information on this?
I guess the problem is the general "select-boxes with forceCharSet=utf8
show garbled characters" problem.
This minor patch (to latest 4.0-CVS) seems to solve it (but read on!!):
diff -u -r1.20 lang.php
--- typo3/sysext/lang/lang.php 18 Dec 2005 20:22:37 -0000 1.20
+++ typo3/sysext/lang/lang.php 26 Jan 2006 15:31:50 -0000
@@ -297,7 +297,7 @@
if (strcmp(substr($input,0,4),'LLL:')) { // Using
obsolete 'language-splitted' labels:
$t = explode('|',$input);
$out = $t[$this->langSplitIndex] ?
$t[$this->langSplitIndex] : $t[0];
- return $this->hscAndCharConv($out, $hsc);
+ return ($hsc?htmlspecialchars($out):$out);
} else { // LOCAL_LANG:
if
(!isset($this->LL_labels_cache[$this->lang][$input])) { // If
cached label
$restStr = trim(substr($input,4));
The only change here is that LANG->sL() won't try to convert from the
encoding specified for the current users language (e.g. iso-latin-1) to
UTF-8. In the case of values coming from the DB, they are already UTF-8,
so this would cause double-encoding.
There might be side-effects, because sL() is also used for the
"language-splitted" labels, but they are obsolete anyway. And I cannot
imagine any latin-1 encoded string to enter this part of the function if
the site is set to forceCharSet=utf8.
Non-forceCharSet-sites aren't affected by this change, because
hscAndCharConv won't don anything other than htmlspecialchars, which I
still do in my change.
Cheers,
Ernesto
PS: I've just commited this information and patch to bugtracker, so
discussion can go on there: http://bugs.typo3.org/view.php?id=2396
More information about the TYPO3-dev
mailing list