I have an html page with special characters like "é" and "ñ" and they get displayed fine, but if I switch the extension to php, weird diamond question marks appear. I've done everything that I know of, I've set the charset to utf-8 everywhere, but still nothing works.
Any ideas?
Text encoding
Moderator: General Moderators
Re: Text encoding
And what is included in "everywhere"? It's pretty much (a) a call to PHP's header() function, or (b) a <meta> in the HTML page's <head>.
Re: Text encoding
How did you include those characters in your php file? Did you(r editor) save it with utf-8 encoding?
Instead of including é and ñ literally, you're probably better off by using their html-entity equivalents: é ñ
Instead of including é and ñ literally, you're probably better off by using their html-entity equivalents: é ñ
Re: Text encoding
I saved it in th php.ini file, in the head (meta) and even in apache.
I don't know how the editor saved the file. Is that the problem?
I don't know how the editor saved the file. Is that the problem?
Re: Text encoding
Yes. In your headers you say you are outputting UTF-8, but what you're actually outputting is whatever encoding your editor happens to use (cause that's what's saved in the .php file, so that's what PHP outputs).rix501 wrote:I don't know how the editor saved the file. Is that the problem?
There are all kinds of solutions to that, but simply using é and ñ and the likes is probably the best way to go.
Re: Text encoding
Just checked it out and it was definitely the text editor saving the file in another encoding.
Thanks for the help!
Thanks for the help!