You can solve it in different ways, I think you should read When to use HTML objects . now your possible solution
- save source file as utf-8
- The string passes it as UTF-8.
You can also print variables using echo and print. Also, do not save the special character in the database.
If you want to delete a special character, try this function $string = preg_replace('/[\x00-\x1F\x7F]/u', '', $string);
source
share