I'm trying to html code various names from around the world. The system I ended up with couldn't handle raw characters natively, so I had to encode them first. htmlentities works fine 99% of the time, but I ran into an exception and couldn't get it to work (I've tried every encoding option in the PHP list). The relevant characters are Latin characters (Ş
and ş
). Any suggestions on how to handle these exceptions? I am using laravel and the code is as follows.
@foreach ($names as $name) {{ htmlentities($name) }}</br> @endforeach
htmlentities() function is based on ISO-8859-1 character table by default. You must provide the encoding as a parameter like this:
You can select the desired encoding from the list of supported character sets in the document.
Source: https://www.php.net/manual/en /function.htmlentities.php