Why mysql_query("SET NAMES 'utf8'");
Posted by: weiguoming
Date: April 14, 2005 08:17PM

Hi all,

I have a database in pure utf-8, the table and each column are in utf8_general_ci.. My html form page is in utf-8 as well: <meta http-equiv="Content-Type" content="text/html; charset=utf-8">.

Then I saved some text into the table, and then display the table, the english is displayed properly, but other languages (chinese in my case) became '???' partially... but I tried using mysql_query("SET NAMES 'utf8'"); after the mysql connection, everything looks fine. does anyone know what mysql_query("SET NAMES 'utf8'"); does, and why i need that?

Also, weird enough, if i have my tables in latin1, the display is correct - the only problem is that when i backup the database using myphpdump and restore it, the text becomes partially unreablable..

Options: ReplyQuote

Written By
Why mysql_query("SET NAMES 'utf8'");
April 14, 2005 08:17PM
February 23, 2009 10:37AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.