Hi i have a table in my mysql db with utf-8 charset but when i made a select in that table and display it in a php page the 'ç', '´' ... still appears wrong.
In phpmyadmin in appears correct.
What could be the problem?
| SitePoint Sponsor |
Hi i have a table in my mysql db with utf-8 charset but when i made a select in that table and display it in a php page the 'ç', '´' ... still appears wrong.
In phpmyadmin in appears correct.
What could be the problem?


Are you also serving the webpage as UTF-8?
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.





Did you pass the value through htmlentities before displaying?

when connect to mysql in php execute following sql:
SET NAMES utf8
then encode your html page in utf8 encoding
I think you should user UTF-8 encoding on your web page as well.that will solve your problem.
I have recently had the same problem and when I used utf-8 on my web page it was working.
In PHP also you will find some functions for encoding and decoding for the same purpose but I personally suggest you to use utf-8 on web page.
Noddy
I am already using UTF-8 in my pages.
The static texts working correctly. Only the dynamic data from mysql appears wrong.
I will give a try to the SET Names function dispite i would prefer a simpler way of doing it.
EDIT: i think is that i have created the db in latin1 instead of utf8. It seems it doesn´t work if i change the encoding later.
I have created a new table in utf8 and it works.
Bookmarks