Project

General

Profile

Actions

Bug #23541

closed

Headline in non latin charsets will break after 100 - substr is not multibyte safe use mb_substr instead

Added by C. Schnetter about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2010-09-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

15712.patch (798 Bytes) 15712.patch Administrator Admin, 2011-01-02 09:52

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #24182: class.tslib_gifbuilder.php default fallback for textMaxLength is to lowClosed2010-11-23

Actions
Actions #1

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/

Actions #2

Updated by Sigfried Arnold almost 14 years ago

somewhat related to #16537

Actions #3

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?

Actions #4

Updated by Jigal van Hemert almost 14 years ago

Committed to trunk rev: 9980

Actions #5

Updated by Susanne Moog over 13 years ago

  • Target version deleted (4.5.0)
Actions

Also available in: Atom PDF