Display unicode data incorrectly

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
hoangvu.che
Forum Newbie
Posts: 19
Joined: Thu Mar 22, 2007 9:54 pm

Display unicode data incorrectly

Post by hoangvu.che »

I have configured MySQL default encoding to utf-8.
Some unicode data is input by hand.

My php page loads the entered unicode data. However, the unicode characters are not displayed correctly although I have set the page encoding to utf-8 and save the php file in unicode format.

I dont know whether I need to configure anything else. Please help me.

thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How did you specify the page encoding?
hoangvu.che
Forum Newbie
Posts: 19
Joined: Thu Mar 22, 2007 9:54 pm

Post by hoangvu.che »

I write the below line in the head section:

Code: Select all

<meta content="text/html; charset=UTF-8" http-equiv="content-type">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

So you didn't also call header() with that information?
hoangvu.che
Forum Newbie
Posts: 19
Joined: Thu Mar 22, 2007 9:54 pm

Post by hoangvu.che »

I am really a junior in web coding. I actually dont understand how to do with the function header() as your instruction.

Could you explain more details?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You probably need to pass the Content-type header through header() as well as in the page data. There's an example of it on the documentation page. You already have the values needed to call it.
hoangvu.che
Forum Newbie
Posts: 19
Joined: Thu Mar 22, 2007 9:54 pm

Post by hoangvu.che »

I have added the following line at the beginning of my page

Code: Select all

header('Content-Type: text/html; charset=UTF-8');
However, no change occurs :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Did you make sure to delete all your cache data to make sure you are looking at the correct version of the page?
hoangvu.che
Forum Newbie
Posts: 19
Joined: Thu Mar 22, 2007 9:54 pm

Post by hoangvu.che »

yes, sure.

I have also cleared all cache data before reload the page.
Post Reply