From 38147751575ed5d903c483b1b0a01940105fd4c3 Mon Sep 17 00:00:00 2001 From: Paul Mehrer Date: Mon, 2 Sep 2024 11:58:48 +0200 Subject: [PATCH] tweak(TB Twig) backport transliterate fix --- tine20/Tinebase/Twig.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tine20/Tinebase/Twig.php b/tine20/Tinebase/Twig.php index b0d12c35a8..6822a6ba26 100644 --- a/tine20/Tinebase/Twig.php +++ b/tine20/Tinebase/Twig.php @@ -160,17 +160,7 @@ protected function _addTwigFunctions() return str_replace(' ', '', (string)$str); })); $this->_twigEnvironment->addFilter(new Twig_SimpleFilter('transliterate', function($str) { - return Tinebase_Helper::replaceSpecialChars($str, false); - // much better would be iconv or transliterator - // iconv('UTF-8', 'ASCII//TRANSLIT', iconv(mb_detect_encoding($str), 'UTF-8//IGNORE', $str)); - // this iconv works very well on the glibc implementation, sadly docker php versions may come with - // a different iconv implementation: Interactive shell - // php > echo ICONV_IMPL; - // unknown - // => that implementation transliterates ö to "o instead of oe - // transliterator_transliterate('de-ASCII', $str); does not transliterate € sign, also I have trouble with - // that 'de' in there... probably the transliterator would be the best option, but we would need to find - // the right way to use it, feel free to improve + return iconv('UTF-8', 'ASCII//TRANSLIT', transliterator_transliterate('de-ASCII', $str)); })); $this->_twigEnvironment->addFilter(new Twig_SimpleFilter('preg_replace', function($subject, $pattern, $replacement, int $limit=-1, int $count=null) {