SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Php/Mysql charset
-
May 11, 2009, 11:53 #1
- Join Date
- Apr 2009
- Location
- Porto,Portugal
- Posts
- 76
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Php/Mysql charset
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?
-
May 11, 2009, 12:58 #2
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Are you also serving the webpage as UTF-8?
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
May 11, 2009, 16:31 #3
- Join Date
- Jan 2002
- Location
- Australia
- Posts
- 2,634
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Did you pass the value through htmlentities before displaying?
-
May 12, 2009, 00:21 #4
- Join Date
- Dec 2008
- Posts
- 120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
when connect to mysql in php execute following sql:
SET NAMES utf8
then encode your html page in utf8 encoding
-
May 12, 2009, 03:07 #5
- Join Date
- May 2009
- Posts
- 65
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
May 13, 2009, 02:24 #6
- Join Date
- Apr 2009
- Location
- Porto,Portugal
- Posts
- 76
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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