Again slugify ignoring accents

Again slugify ignoring accents

Multiple topics with the same problem


@patrick Please correct this code

Hello, @patrick change the default Wappler text.php file to this one text.zip (1.3 KB)

Thanks @AdrianoLuiz. Your custom slugify function saved my day!

1 Like

Yes, this php function is very valuable in this case:

function formatter_slugify($val) {
if ($val == NULL) return NULL;
$a = ‘ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜüÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ"!@#$%&*()-+={[}]/?;:.,\’<>°ºª’;
$b = ‘aaaaaaaceeeeiiiidnoooooouuuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr’;
$val = utf8_decode($val);
$val = strtr($val, utf8_decode($a), $b);
$val = strip_tags(trim($val));
$val = strval($val);
$val = preg_replace(’/[^\w\s]/’, ‘’, $val);
$val = strtolower($val);
$val = preg_replace(’/[
\s]+/’, ‘-’, $val);
$val = preg_replace(’/-+/’, ‘-’, $val);
$val = preg_replace(’/^-/’, ‘’, $val);
return $val;
}

PHP has been constantly upgraded to do more & to do it more quickly. Chances are very good that a PHP function has been created that will take care of just about any issue if it can be handled on the server side at the hosting environment.

I haven’t opened the Wappler text.php to see if the above code has already been incorporated into the default Wappler value transformations.

Thanks for letting us know that you’ve solved your problem!
In doing so someone else is usually helped with their own similar problem.