View Issue Details

IDProjectCategoryView StatusLast Update
0006491OXID eShop (all versions)1.01. Products (product, categories, manufacturer, promotions etc.)public2024-04-03 07:43
Reportergerldental Assigned To 
Status closedResolutionno change required 
Product Version4.9.9 / 5.2.9 
Fixed in Version6.0.0 
Summary0006491: Smarty Modifier 'smarty_modifier_truncate' is not UTF-8 compatible
Description5.2.9 has both modifierin package:
- smarty_modifier_oxtruncate
- smarty_modifier_truncate

and smarty_modifier_truncate seems to only for back-compatibility present.

But it still be a problem if in the template used old truncate modifier - it uses native substr() calls and not UTF-8 compatible. For example it breaks last symbol, if it's not ASCII ( ä, ö, ü, ß in German )
Steps To Reproducefunction smarty_modifier_truncate($string, $length = 80, $etc = '...',
                                  $break_words = false, $middle = false)
    if ($length == 0)
        return '';

    if (strlen($string) > $length) {
        $length -= min($length, strlen($etc));
        if (!$break_words && !$middle) {
            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
        if(!$middle) {
            return substr($string, 0, $length) . $etc;
        } else {
            return substr($string, 0, $length/2) . $etc . substr($string, -$length/2);
    } else {
        return $string;
Additional InformationWhy not refactor it to Oxid string handler ( getStr()->substr() )?
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined



2016-08-25 11:23

administrator   ~0011753

The bug is not reproducible. Kindly provide some information on where exactly this bug arises. A screenshot would also be helpful.


2016-08-25 14:14

reporter   ~0011754

If we truncating with modifier 'truncate' something like "Packung 200 Hüllen"|truncate:14

We getting "Packung 200 H?"

The reason why, may be the fact, that utf-8 symbols taking 2 bytes and substr() cuts second byte off...

This issue with substr() and utf-8 can be founded on stack overflow:

Correct would be mb_substr() which realised in oxStr class (calling handler oxstrmb)

As i said - it's works properly in oxtruncate, but truncate is still not utf-8 compatible, and i don't understand why.

Sven Brunk

2024-04-03 07:43

administrator   ~0016686

This is the original Smarty plugin that we did not support anyway. On top of that: The oxtruncate plugin did what you requested from the start. Meanwhile, the truncate plugin has been removed in 6.0
And since we are not supporting Smarty anymore (e.g. for reasons like described in this ticket), this ticket is now obsolete.