Vox Populi(x) forum

Alexandria Book Library => Errori (Bugs) => Topic started by: sertlan on 22 July 2024, 17:38:32

Title: The substr function causes errors with Cyrillic characters
Post by: sertlan on 22 July 2024, 17:38:32
Hi federica.

The substr function causes errors with Cyrillic characters.
Example: Вашему вниманию предлагается полное собрание сочинен

It's better to use the mb_substr function.

Please replace in the file "components/com_abook/layouts/category/item.php"
this code:
<?php echo substr(strip_tags($item->description), 0100);?>with this code:
<?php echo mb_substr(strip_tags($item->description), 0100'UTF-8') . '...';?>
Title: Re: The substr function causes errors with Cyrillic characters
Post by: federica on 22 July 2024, 18:50:39
I found this Joomla core function. Try this code.
<?php echo HTMLHelper::_('string.truncate'strip_tags($item->description), 100,truefalse ); ?>
Let me know it is ok.
Title: Re: The substr function causes errors with Cyrillic characters
Post by: sertlan on 22 July 2024, 20:26:36
Quote from: federica on 22 July 2024, 18:50:39<?php echo HTMLHelper::_('string.truncate'strip_tags($item->description), 100,truefalse ); ?>
This code works without errors.
Title: Re: The substr function causes errors with Cyrillic characters
Post by: federica on 23 July 2024, 09:30:07
I will publish a new beta version as soon as possible.