I’m having a problem with my php web app. It is in Portuguese, and while all the data into and from the database inputs and outputs fine, and all the inline html outputs fine, the php strings don’t.
For example:
If I have a function that outputs the last update of the database entry:
$output .= 'Última atualização: ' . $date . '.';
When php echoes the above all the accented characters will be garbled. If the same are inline in the HTML or from the database they display normally.
Note: I have declared my encoding as utf-8 both in the html header and in the php script.
The actual PHP file (which is just a text file) also has to have the respective encoding.
And it doesn’t work to just add the correct header. You have to open the file, check if the encoding is utf8, if not, cut everything, change the encoding to utf8 and paste everything back. It doesn’t work, if you just change the encoding and save the file, unless your text editor has such a function of course!