Try using htmlentities to convert latin characters
P粉111227898
P粉111227898 2023-09-10 20:57:45
0
1
642

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

P粉111227898
P粉111227898

reply all(1)
P粉970736384

htmlentities() function is based on ISO-8859-1 character table by default. You must provide the encoding as a parameter like this:

htmlentities($name, ENT_QUOTES, 'UTF-8')

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template