Bug #23541
closedHeadline in non latin charsets will break after 100 - substr is not multibyte safe use mb_substr instead
0%
Description
Expperienced on T4.1, but should be the same in 4.2,4.3 and 4.4
Creating grafic headlines gives problems with non latin charsets, breaks in between, because of the use of substr, and then displays chars which do not belong to the language.
Example TS:
styles.header.typ1 >
styles.header.typ1 = IMAGE
styles.header.typ1 {
file = GIFBUILDER
file {
XY = [10.w]+10, 52
backColor = {$HEADER_BACKCOLOR}
transparentColor = {$HEADER_TRANSCOLOR}
10 = TEXT
10 {
niceText = 1
antiAlias = 1
text.current = 1
offset = 0, 37
fontSize = {$HEADER_FONTSIZE}
fontFile = {$HEADER_FONTFILE} # russian font here
fontColor = {$HEADER_FONTCOLOR}
text.HTMLparser = 1
text.HTMLparser.htmlSpecialChars = -1
}
}
}
lib.stdheader.10.1 >
lib.stdheader.10.1 < styles.header.typ1
So now this will be processed in class.tslib_gifbuilder.php in line 511.
$tlen = intval($conf['textMaxLength']) ? intval($conf['textMaxLength']) : 100;
Here 100 is hardcoded.
In the next line, which is 512, it sais:
$conf['text'] = substr($conf['text'],0,$tlen);
IMHO this should be rewritten using mb_substr (http://de3.php.net/manual/de/function.mb-substr.php) so it will be multibyte safe.
=)
As is:
$conf['text'] = substr($conf['text'],0,$tlen);
Should be replaced through.
$conf['text'] = mb_substr($conf['text'],0,$tlen);
(issue imported from #M15712)
Files
Updated by Chris topher about 14 years ago
Please make a diff or patch file out of your changes and send your patch to Core List as explained here:
http://typo3.org/teams/core/core-mailinglist-rules/
Updated by Jigal van Hemert almost 14 years ago
Not all installations have mb_string configured, so it should IMO use t3lib_cs::substr() which supports various methods.
In attached patch (for 4.5 trunk) I tested for the availability of a BE charset (if that is not present your installation is probably a mess anyway, because each BE user can enter content in a different character set) and use that character set for the operation.
Can you test this?