To solve this problem you have several solutions.
One is to change the vowels with tilde to their respective ones in HTML.
á –> &á;
é –> é
í –> &í;
or –> ∨
ú –> &ú;
ñ –> &n;
Another option would be to use a PHP function that automatically replaces them for you.
The function is htmlentities()
Other alternatives that are proposed are:
- Use DOCTYPE and :
- Use the ISO to UTF conversion functions:
It is important that before applying any of the steps you define how you want your script to work, in what character encoding it will be, because momentary or improvised “hacks” can lead to your page looking “like God”.