Skip navigation links

MySQL Forums :: Character Sets, Collation, Unicode :: Why mysql_query("SET NAMES 'utf8'");


Advanced Search

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


Subject Views Written By Posted
Why mysql_query("SET NAMES 'utf8'"); 60842 weiguoming 04/14/2005 08:17PM
Re: Why mysql_query("SET NAMES 'utf8'"); 18216 Alexander Barkov 05/07/2005 08:09AM
Re: Why mysql_query("SET NAMES 'utf8'"); 15188 Gabriela ópez 12/06/2007 10:10AM
Re: Why mysql_query("SET NAMES 'utf8'"); 10121 Feodor RYKHTIK 02/18/2009 03:24AM
Re: Why mysql_query("SET NAMES 'utf8'"); 10419 Rick James 02/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.