View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006491 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2016-08-25 09:20 | 2024-04-03 07:43 |
Reporter | gerldental | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Product Version | 4.9.9 / 5.2.9 | ||||
Fixed in Version | 6.0.0 | ||||
Summary | 0006491: Smarty Modifier 'smarty_modifier_truncate' is not UTF-8 compatible | ||||
Description | 5.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 Reproduce | function 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 Information | Why not refactor it to Oxid string handler ( getStr()->substr() )? | ||||
Tags | No tags attached. | ||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
|
The bug is not reproducible. Kindly provide some information on where exactly this bug arises. A screenshot would also be helpful. |
|
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: http://stackoverflow.com/questions/9087502/php-substr-function-with-utf-8-leaves-marks-at-the-end 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. |
|
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. |