In my model i get content of input search, i just want to clean accented characters before doing a query. In Joomla! is-there a method to clean in string the accented characters ?
Thanks by advance
use Joomla\CMS\Factory;
....
$lang = Factory::getLanguage();
$lang->transliterate($value);
* This method processes a string and replaces all accented UTF-8 characters by unaccented
* ASCII-7 "equivalents".
Or check the method code to be more granular: libraries/src/Language/Language.php
public function transliterate($string)
{
if ($this->transliterator !== null)
{
return call_user_func($this->transliterator, $string);
}
$string = Transliterate::utf8_latin_to_ascii($string);
$string = StringHelper::strtolower($string);
return $string;
}
So you may go with
$string = Joomla\CMS\Language\Transliterate::utf8_latin_to_ascii($string);