UTF8 characters problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

UTF8 characters problem

Post by yacahuma »

I hope someone can help me here . It is driving me crazy.

For the first time I am writing an application with utf-8 in the application and in the database.

for all my outputs I am using

htmlentities($data,ENT_QUOTES,'UTF-8')

also I am using in the header

meta http-equiv="content-type" content="text/html;charset=utf-8"

The database is all utf8 and utf8-general_ci (every character field with utf8)

Inside the application all the Spanish characters look fine. But if I see those characters using phpmyadmin or Navicat they look weird.

Before I used latin1 and spanish characters will look fine of the web and on the database and i did not have to do the htmlentities (altought I should have use it anayway).

What am I missing?? What is the secret formula to get this working??
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I don't get what your asking. If everything is working in a browser, then everything is fine. If they are messing up in the database don't worry about it as long as it comes back correct.

Edit: But if you really want it fixed read this: http://www.phpwact.org/php/i18n/utf-8/mysql
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

I would also suggest to check your Apache (if you use this www server) directives - especially "AddDefaultCharset" - it must be turned "Off" if you want to have control on charsets being used.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

mysql clients need to be told character set

Post by yacahuma »

There is a setup in Navicat that allows you to force the enconding you are looking. I change it to be utf 8 and now when I work on navicat i see the characters as expected.


I dont know how to do the same thing on phpmyadmin??

The main problem was that I was not sure whos fault was it. I thought the mysql clients will automatically detect the encoding and show the correct character set. I was wrong.
Post Reply