How do I handle the output correctly because I have characters like these é , á , ú, ý but...when I query it shows this character
I already did my homework( research)
I fix the meta tag
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
and added mysql_query("SET NAMES 'utf8'"); after the mysql connection.
can anyone suggest solutions? , please thank you
--edit--
Im just creating a basic SELECT query using PHP and MySQL
I set already the Collation to 'utf8_general_ci' for the column Im querying
Check your table encoding and client side encoding. Are these all the same?
Running SET NAMES
after the data is garbled wont make much of a difference. I recently had the same problem. I fixed it with the following steps
SET NAMES
) SET NAMES
to the connection When you load the page the first time without SET NAMES
it should show up properly. If it's not showing properly in the form, that means you might have forgotten to set the encoding on your page.
This is assuming that all your tables have the proper collation/encoding.
Are you 100% sure the collation is set properly for all tables in your database? You could try out a tool like Phoca Changing Collation to convert your whole database to utf8_general_ci.
This could corrupt your current data so be sure to make a proper backup before you run it.
尝试将此行放在您的PHP文件的顶部:
header('Content-Type: text/html; charset=utf-8');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.